Authorities have arrested 35 soldiers who served on an army base in northern Afghanistan where the Taliban staged a deadly attack last week, officials said Wednesday, as fears grew they had inside help.

The defence ministry released its official toll of 135 recruits killed in the assault on the sprawling base, home to the 209th Army Corps, outside the city of Mazar-i-Sharif in Balkh province on Friday.

Gunmen in military trucks and wearing suicide vests stormed the base, killing unarmed young recruits as they ate lunch in the dining hall and prayed in the mosque.

The brutal assault is believed to be the deadliest-ever Taliban attack on a military installation.

The death toll has been unclear, with Afghan officials -- who have been known to minimise casualties in previous attacks -- ignoring earlier calls for exact figures.

A senior US defence official has told AFP at least 144 people were killed, while some sources on the base have placed the toll as high as 160.

The gunmen were dressed in army uniforms, multiple sources have told AFP, fuelling suspicions of complicity on the 30,000-strong base, where Western instructors are sometimes called on as part of NATO's training, assistance and advisory mission.

They also carried valid passes to the base, a senior security source has told AFP.

"So far 35 people have been detained and are being questioned in connection with the attack," said 209th Corps spokesman Abdul Qahar Aram, adding that they ranked from foot soldiers to colonel.

So-called insider attacks -- when Afghan soldiers and police turn their guns on their colleagues or on international troops -- have been a major problem during the war which began in 2001.

Analyst and university professor Abdul Hamid Safoot said Friday's assault had highlighted multiple systematic flaws among Afghan forces, ranging from a lack of vetting to inadequate intelligence sharing.

"(The) Taliban know these weaknesses, they have people in the government," Safoot said.

"After the insider attacks on the NATO trainers increased, the foreign mentors no longer allow Afghan soldiers to carry arms during training," he added.

The recruits in the mosque and the dining hall were unarmed -- a fact which the security source said was known to the militants. He said at least four of the attackers had served at the base.

The assault has prompted widespread anger, with the defence minister and his army chief resigning Monday, leaving troops and police in disarray as the Taliban gear up for their spring offensive.

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

Their casualties soared by 35 percent in 2016, with 6,800 soldiers and police killed, according to US watchdog SIGAR.