Acting spokesman for Mr. Ghani, said the resignations were because of Friday's attack on a army base in the city of Mazar-i-Sharif.

Afghanistan’s Defence Minister and army chief of staff resigned on Monday after the deadliest ever Taliban attack on a military base, threatening to overshadow a visit by U.S. Defense Secretary Jim Mattis as Washington looks to craft a new strategy for the country.

Mr. Mattis was expected to meet Afghan officials and U.S. commanders who are pushing for more troops. But his arrival in Kabul came amid the fall-out from Friday’s Taliban assault on a base in the north of the country in which more than 140 Afghan soldiers were killed.

“Defence Minister Abdullah Habibi and Army Chief of Staff Qadam Shah Shahim stepped down with immediate effect,” the office of Afghan President Ashraf Ghani announced in a post on its Twitter account.

Shah Hussain Murtazawi, acting spokesman for Mr. Ghani, told Reuters the resignations were because of Friday's attack on a major army base in the city of Mazar-i-Sharif.

Mr. Ghani's office also announced that he had replaced the commanders of four army corps in response to the attack, and defence officials said as many as eight army personnel had been arrested - heightening suspicions the attackers had inside help.

The attack underlines the scale of the challenge facing the Western-backed government and its international partners more than 15 years after the United States invaded the country.

Mr. Habibi had come under intense pressure from Afghan lawmakers following an Islamic State attack on a Kabul military hospital in March.

At a news conference on Monday, Mr. Habibi and Gen. Shahim insisted their resignations were voluntary.

“We should always look for solutions to problems and therefore I have decided that there should be another guardian standing guard,” Mr.Habibi told reporters.

Deadly Attack

In a serious security failure, as many as 10 Taliban fighters, dressed in Afghan army uniforms and driving military vehicles, made their way onto the base and opened fire on soldiers and new recruits eating a meal and leaving a mosque after Friday prayers, according to officials.

Multiple Afghan officials said the final death toll was likely to be even higher.

A senior U.S. official said, based on intelligence and the types of tactics used, the Taliban-linked Haqqani network likely played a role.

“This is very typical Haqqani network tactics, techniques and procedures,” said the official, adding that the United States believed it took four to six months to plan the attack.

Mr. Ghani declared on Sunday a day of mourning for those who died, ordering flags to be flown at half staff.

The attack came just over a week after the United States dropped a 22,000 pound bomb, known as the “mother of all bombs”, against a series of Islamic State caves and tunnels near the border with Pakistan.

U.S. officials say they were surprised by the level of attention that particular bomb got, since it did little to change the overall situation ground where the larger threat remained the Taliban, not Islamic State.

More Troops

U.S. officials acknowledge that Afghanistan has rarely in recent years been considered a priority by decision-makers, who have instead been consumed by Syria, Iraq and, increasingly, North Korea.

But there are signs the administration of new President Donald Trump is making progress in crafting a policy for Afghanistan.

Mr. Trump's National Security Adviser H.R. McMaster visited Afghanistan this month, becoming the first senior official from the new administration to do so.

U.S. officials, speaking on the condition of anonymity, said there was currently an inter-agency review under way, which could take several weeks, to determine the goals and milestones for the United States in Afghanistan.

Meanwhile the Afghan army is preparing for what is expected to be a year of hard fighting against Taliban militants, who now control or contest more than 40 percent of the country.

Nearly 9,000 U.S. troops remain in Afghanistan, in addition to thousands of international coalition forces.

General John Nicholson, the top U.S. commander in Afghanistan, recently told a Congressional hearing he needed several thousand more international troops in order to break a stalemate in the long war with Taliban insurgents.

U.S. officials say that Gen. Nicholson's request was making its way through the chain of command. Conversations, however, according to current and former officials, were revolving around 3,000 to 5,000 additional troops.

One official said there was an emphasis on creating a strategy that was not tied to artificial deadlines. Former President Barack Obama had wanted to reduce the number of U.S. troops in Afghanistan before he left office.

While Mr. Mattis is no stranger to Afghanistan - he served there and was also the head of U.S. Central Command - there are questions about what a few thousand additional U.S. troops can achieve in the country.

“Let's face it, no matter how many troops you may send to Afghanistan it is going to be very difficult to end the war, we had 100,000 troops fighting in Afghanistan during height of the surge and we didn't end the war,” said Michael Kugelman, a South Asia expert and the Woodrow Wilson Center.