"More than 50 Afghan soldiers were killed" belonging to the 209th Corps, stationed near the northern capital of Mazar-i-Sharif, a spokesman for the US military in Kabul.
No record could be obtained from Afghan sources.
The attack, which began around 14:00 local time (9:30 am GMT) and ended in the early evening, involved a dozen assailants, according to Defense Ministry spokesman General Dawlat Waziri, AFP.
"In total, ten attackers carried out the attack, seven of them were killed, two were detonated and one was arrested by Afghan forces," General Waziri said.
He had previously stated that the commando had appeared "in uniform". It is the worst attack on Afghan forces since the assault on the main military hospital in the country, claimed by the Islamic State group in early March in Kabul, which officially claimed 50 lives - and probably more than double.
In a statement, US General John Nicholson, who commanded NATO's Resolute Support operation in Afghanistan, said the attack targeted "men during prayers at the mosque and others in the refectory" based.
The general "paid tribute to the Afghan commandos who put an end to these atrocities", confirming the end of operations and the intervention of the Afghan special forces, trained and trained by the Western forces.
A first report of the Afghan Ministry of Defense gave eight killed and 11 wounded. Afghan officials tend to minimize the record of jihadist attacks.
Moreover, no additional details were available in the evening on the mode of operation of the command which resisted for the last combatants more than five hours.
The Taliban quickly claimed the operation in a statement.
"At about 1400 GMT, our mujahideen launched a complex attack on the army corps stationed in Mazar-i-Sharif, Balkh province, killing dozens of soldiers," the spokesman said. Zabihullah Mujahib, known for regularly exaggerating the balance sheets.
At the hour of prayer
It occurred at midday, at the hour of the great prayer on Friday when the men are disarmed.
On the spot, the commander of the army corps in the province, General Mohmand Katawazi, reported late in the day the persistence of fire "between the army and the assailants."
In the evening this officer could no longer be joined despite many attempts.
Several military helicopters flew over the site for a long time while operations were still under way and ambulances evacuated the bodies of the victims, the AFP correspondent said.
Since the attack on the Sardar Daud Khan Hospital on March 8, which lasted more than six hours in the heart of Kabul, many feared a spectacular response by the Taliban. Although the responsibility for the IA has not been formally established.
Meanwhile, the Taliban are preparing to launch their traditional spring offensive from one moment to the next, even though the winter break was only partial this season.
Since 2015 and the withdrawal of the majority of Western forces at the end of 2014, Islamist insurgents are continuing to push the fronts of an overwhelmed Afghan army, despite NATO advisers and US air strikes conducted to support them.
The United States retains 8,400 men stationed in the country. General Nicholson felt in February before the Congress in Washington that it would take "a few thousand more" to overcome the offensive.
More than a third of the country's territory is beyond the control of the Afghan government and many regions are fiercely contested by the various parties.
On April 13, US forces used the most powerful conventional bombs in their possession against a network of tunnels and caves used by the IE in the east of the country, killing 96 in the jihadist ranks.
The area has not been reopened to civilians ever since.