But the housecleaning edicts late last month resonated with many Afghans. They have been long disillusioned by corruption and sloppiness in the security forces through 17 years of war and militant violence — and now they may have to face the fight with fewer forces from their powerful partner, the United States.

AD

A separate pledge from Saleh, a former intelligence chief, spoke directly to the public anger and the security forces’ battered reputation. He said he wanted to become known as a “brutal minister against criminals and the enemies of the country.”

AD

Saleh’s appointment as interior minister two weeks ago was part of a high-level shake-up ordered by President Ashraf Ghani as his government has floundered on all fronts.

It had failed to beat back Taliban attacks, has been excluded from international peace talks with the Taliban and been unable to set a date for national polls in which Ghani hoped to win reelection.

The Trump administration, having pushed hard for peace talks, suddenly said it was making plans to withdraw thousands of troops. Taliban leaders eagerly joined meetings with the United States and other foreign governments but refused to meet with Afghan officials and continued to wage attacks across the country.

AD

“There was a need to send a different message,” said Nader Nadery, a senior aide to Ghani, describing the sweeping changes.

AD

“One part was to show we would do everything it takes to protect our country and people, without leading the public to expect miracles,” he said. “The other was to send a clear message to the Taliban: ‘If you want to talk, we’re ready. If you want to fight, we’re also ready.’ ”

Ghani has made high-level shuffles in the past when crises have struck, such as replacing generals after embarrassing insurgent breaches of highly secured bases. But this is the first time the president, long viewed as isolated and reliant on a small group of loyalists, has deliberately sought to bring in a mix of loyalists, critics and competitors. It created what Nadery called “a tight team of rivals.”

AD

By putting Saleh in charge of the national police, Ghani hired a vocal and acerbic critic from the largest opposition party. At the same time, he named another former spy chief, Asadullah Khalid, as the new defense minister. He also persuaded Mohammad Umer Daudzai, an influential former cabinet minister and declared candidate for the presidency, to head the once-sidelined Afghan High Peace Council.

AD

“There is a sense now that things have become more united and coherent in Kabul,” said Davood Moradian, who is executive director of the Afghan Institute of Strategic Studies and has often disagreed with Ghani and his policies. “The Taliban strategy has been to divide and rule, but now people who may still differ with the government are saying it needs to be supported.”

The appointments of Saleh and Khalid were intended in part to fill the void left by the October assassination of a powerful anti-Taliban police commander in Kandahar, Gen. Abdul Raziq Achakzai, which stunned the government and deflated public morale.

AD

Saleh and Khalid were known as tough on the Taliban and highly critical of Pakistan’s alleged role in backing anti-Afghan attacks. Khalid had served as governor in Kandahar, where he was accused of brutality against Taliban prisoners a decade ago. He was severely injured in a Taliban assassination attempt in 2012. In his first statement as defense minister, he urged the armed forces to act “cruelly” against the insurgents.

AD

A retired army general and analyst, Attiqullah Amarkhail, said the twin appointments might “boost the morale of the security forces and psychologically impact the Taliban, too.” Ghani, he suggested, hopes to gain “an upper hand militarily so he can have a strong position in peace talks.”

Ghani was also weakened by the abrupt departure of his ambitious national security adviser, Hanif Atmar, just as peace discussions were getting underway in October. The president quickly replaced him with Hamdullah Mohib, 36, a protege with an academic background who had served as his ambassador in Washington for three years.

AD

Mohib, dismissed at first by critics as too young and inexperienced for the job, has taken on a low-profile but active role in persuading opponents from various political and ethnic factions to bolster a united push for peace, rather than sniping for their own benefit or proposing a variety of competing agendas for negotiation.

AD

With presidential elections now slated for July, politics could still undermine that goal, however.

“The greatest threat to our national security is not the Taliban — it is the lack of social cohesion,” Mohib said in a recent interview, noting that Afghanistan has long been plagued by ethnic and factional rivalries. “We are focusing on how to bring that cohesion back.”

AD

It is not enough to focus on stopping the fight, he added. “To reach peace and stability in the future, there has to be a place inside the room for everyone to feel represented,” he said.

Although the Taliban continues to insist it will negotiate only with U.S. officials, many Afghans fear that this could lead to a foreign withdrawal without an agreement on what will happen afterward. They feel strongly that issues such as how much power the extremist Taliban leaders will gain, and how much public freedom and rights will be preserved, should be settled by their own leaders.

AD

“There is no negotiating table without Afghans,” Mohib said, noting that 140,000 Afghans have already died in the war. “This country has to be in charge of its own future.”