MAZAR-I-SHARIF: More than 100 Afghan soldiers were killed and wounded in a Taliban attack on an army base in northern Afghanistan, the defence ministry said Saturday, the latest in a string of deadly assaults against Afghan military sites.

The ministry did not give a breakdown of the casualties in the hours-long attack near Mazar-i-Sharif city on Friday. The US military has said that "more than 50" Afghan soldiers were killed, while an Afghan army source who was on the base at the time put the death toll as high as 150, with dozens more wounded.

"They entered the compound using two army trucks with machine guns on top of them. They opened fire on everyone. And then they entered the mosque and dining room, killing everyone indiscriminately," Mohammad Hussain, an army officer wounded in the attack, said as he was treated in hospital.

Two of the attackers blew themselves up in the raid, which was claimed by the Taliban late Friday and which underscores rising insecurity as Afghanistan braces for an intense spring fighting season.

All were dressed in Afghan army uniforms, the source said, speaking on condition of anonymity and adding that no civilians were killed.

"Three months ago I sent my son to the army, I have not seen him since then. And today, they give me his remains," one grieving father told AFP.

Noorullah, a second officer injured in the attack, speculated the militants may have had "inside help", noting they had to pass through at least seven checkposts before entering the compound.

The defence ministry said Afghan forces had killed all the attackers, without specifying how many there were. Earlier it had said one of the assailants had been detained.

The military source at the base said there were at least 10 attackers, adding that the soldiers were "young recruits who had come for training".

"I was in a room close to the mosque, their leader came in and shouted 'aim for their heads'. I jumped out of the window, my friends were killed," one 19-year-old soldier, Mohammad Qurban, told AFP from hospital where he was being treated for hand and stomach injuries.

The toll could change, the defence ministry said in a statement, adding it would provide more information once an investigation was completed.

Afghan officials have been known to minimise casualty figures in some major attacks on military sites, such as in early March when gunmen disguised as doctors stormed the country's largest military hospital in Kabul, killing dozens.

Officials put the death toll in that attack at 50, but security sources and survivors told AFP more than 100 were killed in the brazen and savage assault.

- Military targets -

Afghan President Ashraf Ghani flew to Mazar-i-Sharif on Saturday to pay a "courtesy visit" to wounded soldiers, his office said, while General John Nicholson, the top US commander in Afghanistan, praised Afghan commandos for bringing the "atrocity to an end".

Afghan security forces, beset by killings and desertions, have been struggling to beat back insurgents since US-led NATO troops ended their combat mission in December 2014.

According to US watchdog SIGAR, casualties among Afghan security forces soared by 35 percent in 2016, with 6,800 soldiers and police killed.

The attack on the Kabul hospital in March came a week after 16 people were killed in simultaneous Taliban suicide assaults on two security compounds in the capital.

More than a third of Afghanistan is outside government control and many regions are fiercely contested by various insurgent groups, as Kabul's repeated bids to launch peace negotiations with the Taliban have failed.

The US has around 8,400 troops in the country with about another 5,000 from NATO allies assisting a much larger Afghan force in the war against the Taliban and other Islamist militants

Nicholson in February told US officials in Washington that he needed "a few thousand" more troops.

Earlier this month the US military dropped its largest non-nuclear bomb on Islamic State group hideouts in eastern Afghanistan, killing nearly a hundred militants, according to unverified figures from Afghan officials.