KABUL — Relieved Afghan officials instantly welcomed President Trump’s strategy announcement Tuesday, citing his assurance of broad U.S. military, economic and political support despite a lack of specific pledges, and praising his tough stance on Pakistan, which he denounced for offering safe haven to “terrorists” and “agents of chaos.”

Shortly after Trump’s speech, Afghan President Ashraf Ghani described himself as “grateful to President Trump and the American people for this affirmation of support for our efforts to achieve self reliance.”

The Afghan ambassador in Washington described the speech as “the first time a focus has been put on what Afghanistan must have to succeed,” and a sign of strong commitment to “our shared goals.”

Reaction among Afghan analysts and commentators was more mixed. Some said they appreciated the U.S. for not abandoning the war effort, as Trump had suggested before his election, but others said no new U.S. military strategy can help bring peace and stability unless the Afghan government, weakened by internal divisions and external attacks, can function better and bring meaningful reforms — the kind of state building specifically ruled out by Trump.

A number of Afghan observers noted with concern that Trump had not clearly stated his policy toward the Afghan Taliban, instead emphasizing the importance of preventing global terrorism from spreading. Trump said the U.S. would not allow the insurgents to “occupy Afghanistan,” but he mentioned a political settlement with them only as a vague “possibility,” someday in the future.

“I have never been more in agreement with President Trump,” Sarwar Hussaini posted on Facebook, calling most of his policy points wise and reasonable. “The only thing he was not clear enough about was the Taliban. Without a settlement, Hussaini added, “they can still have their evil organization, still spread terror and horror” and threaten Afghan citizens.

The Taliban issued a defiant statement, saying, “It looks like America does not want to put an end to its longest war and instead of realizing the realities, it still is arrogant on its might and force.” As long as “one American soldier remains on our soil,” said spokesman Zabiullah Mujahid, “we will continue our jihad against them.” If the U.S. does not withdraw, Mujahid added, “Afghanistan will become another graveyard for this superpower.”

In Pakistan, commentators said Trump’s implied threat to cut aid unless the country stops “housing … terrorists” was a stark departure from more tolerant U.S. policies of the past, especially combined with his friendly comments about Pakistan’s archrival India. They said Pakistan, which depends heavily on foreign aid, has little means to push back. Some warned of U.S. cross-border attacks and deep drone strikes.

“I see pressure increasing on Pakistan after President Trump’s statement. Pakistan can only respond to this pressure if it is economically strong, which we are not,” said Hassan Askari Rizvi, a defense and policy analyst in Lahore. “Now only making statements about denying terrorist sanctuaries will not work,” he added. “We are heading for tough times.”

Mosharraf Zaidi, a Pakistani newspaper columnist, sent out a series of sharply-worded tweets Tuesday morning, saying that Trump had “caved in to the U.S. establishment” and decided to blame Pakistan for former president Barack Obama’s failures in Afghanistan.

“There should be little doubt after this speech that the long-term trajectory for Pakistan-U.S. relations is a sanctions regime,” Zaidi said in one tweet. Pakistan has long been treated as a valued partner in U.S. foreign policy, but U.S. military officials and some civilian experts urged the Trump administration to take harsher measures because of its protection of anti-Afghan militias.

Afghans expressed little concern that Trump did not specify how many troops the U.S. would send to Afghanistan, an issue that has gotten obsessive coverage in the U.S. Some noted that Trump had already authorized Defense Secretary Jim Mattis to make such decisions, that it was widely expected that 3,000 to 4,000 troops will be sent, and that U.S. military officials had stressed their role would be to train and strengthen Afghan forces, not replace them.

Instead, Afghans said several other aspects of Trump’s strategy mattered far more, and they praised his decision to peg the timing and nature of U.S. support to conditions in Afghanistan. Many said former president Barack Obama’s decision to set deadlines for troop withdrawal had been a serious mistake, allowing the Taliban to wait and then surge back, and that Trump was right to be more unpredictable.

On the other hand, there was concern over Trump’s statement that the United States would no longer support “nation building” in Afghanistan, saying it would focus instead on fighting terrorism and protecting American interests. The U.S. has propped up the Afghan government for 16 years, but it is riven by internal dissent and eternal criticism and the economy is badly ailing.

Many Afghans see corruption and poor governance as major causes of the country’s problems and the insurgents’ success. Afghan officials are hoping their current anti-corruption drive and efforts at public sector reform will be seen as fulfilling the “conditions” that Trump laid down Tuesday for ongoing U.S. support, but some critics say more needs to be done.

“Afghanistan has the potential to be an inspiration for the Islamic world in building a moderate, pluralistic and U.S.-friendly polity, but first it needs to build a more legitimate, inclusive government,” said Davood Moradian, executive director of the Afghan Institute for Strategic Studies. “Managing Afghan domestic politics remains Washington’s Achilles’ heel.”

Ghulam Farooq, 23, a university student in Kabul, said he hoped Trump’s new strategy would help defeat the Taliban and Islamic State insurgents, but that it was also important for the United States to “stand firm” on its commitment to fight corruption and support democracy after decades of conflict.

“The people of our country have become hostages in the hands of both terrorists and corrupt officials,” Farooq said. “We are suffering and only a handful of politicians are benefiting. All their promises for a better life, security, fighting corruption and creating jobs are just cheap talk to us. If the U.S. does not put pressure on this, it can bring down our all institutions.”

Sharif Walid and Sayed Salahuddin in Kabul and Shaiq Hussain in Islamabad contributed to this report.