MAZAR-I-SHARIF, Afghanistan Dozens of Afghan soldiers were killed or wounded on Friday when Taliban gunmen disguised in Afghan army uniform talked their way past checkpoints and attacked a military base, officials said.

A U.S. official in Washington put the toll at more than 50 killed and wounded. Afghan officials offered conflicting numbers of casualties in the incident, at a major headquarters in northern Afghanistan often used by foreign military advisers.

The Western-backed Afghan government is locked in a prolonged war with Taliban insurgents and other militant groups.

The attack was launched near a mosque on the base in Mazar-i-Sharif, the capital of Balkh province, as soldiers were leaving Friday prayers, said army spokesman Nasratullah Jamshidi.

Six attackers in two military vehicles told guards at the gates that they were carrying wounded soldiers and urgently needed to enter, he said.

After killing at least eight soldiers and wounding 11 others with rocket-propelled grenades and guns, one attacker was killed and the other five arrested, Jamshidi said.

Another Afghan official, speaking on condition of anonymity as he was not authorized to speak publicly, said more than 20 soldiers had been killed and 50 wounded.

A number of German and other foreign soldiers are based in Mazar-i-Sharif, including about 70 who advise the corps headquarters as part of a NATO-led multinational mission to advise and train the Afghan security forces.

"To our knowledge, no Germans were affected. Nor were any other soldiers in the multinational force harmed," said a spokesman for the German Operations Command. The statement was echoed by American officials.

Taliban spokesman Zabihullah Mujahid said the attackers had set off an explosion, allowing suicide bombers with small arms to breach the base's defenses.

"Our fighters have inflicted heavy casualties on the Afghan army stationed there," he said.

The base is the headquarters for the Afghan National Army's 209th Corps, responsible for much of northern Afghanistan, including Kunduz province where there has been heavy fighting.

The NATO command in Kabul called the attack "murderous and reprehensible".

(Additional reporting by Sabine Siebold in Berlin and Phil Stewart in Washington; Writing by Josh Smith; Editing by Andrew Roche)