Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

PESHAWAR, Pakistan — The Taliban had called for special prayers in the hope President Donald Trump would call for a complete withdrawal from Afghanistan, members of the group told NBC News.

Trump ended up taking the opposite path on Monday and backed a continued military presence that centered around empowering his generals and squeezing neighboring Pakistan, a U.S. ally that has often been accused of harboring and enabling terror groups.

This angered many in Pakistan, with several lawmakers publicly denouncing Trump for calling them out on the world stage.

But the Taliban, which has regained control of swaths of the country since being toppled in 2001, claimed that despite Trump going against their wishes they were happy to keep fighting in America's longest war.

"We know how to defend our motherland," said one of the commanders, who, like many of the militants, spoke on condition of anonymity. "If we could fight this war for 16 years with limited resources against the world's well-equipped armies, we are happy to continue this fight against the enemy."

The senior Taliban figures interviewed by NBC News said they were surprised and disappointed by Trump's decision to stick with a conflict that has shown no signs of ending across three U.S. administrations. They had expected him to follow through on his erstwhile viewpoint that the U.S. should pull out.

"President Trump also failed to understand Afghanistan and the problems there," said another senior Taliban commander.

"I am grateful to President Trump and the American people for this affirmation of support"

"We thought him different from his predecessors, but like other U.S. presidents, he too succumbed to the pressure and misinformation of his military commanders and succeeded in wasting their human lives and resources in Afghanistan," the commander added, after watching Trump's announcement in a remote village in Afghanistan's Helmand province — a militant stronghold.

Later, the Taliban issued an official statement warning that if the U.S. did not pull out the group would "make this country the 21st century graveyard for the American empire."

More than a decade-and-a-half since the U.S. toppled the Taliban government after it sheltered the authors of the Sept. 11, 2001, attacks on the U.S., the American military has shown little sign of driving out the militant group.

During its time in power, the Taliban imposed its harsh interpretation of Islam on the country, forcing women to wear head-to-toe burkas, discouraging girls from going to school, and jailing men who did not grow beards. They also introduced public executions and amputations for crimes such as adultery, and banned music, television and the movies.

While the war ousted them from power, it has seen the deaths of more than 2,200 American military personnel, tens of thousands of civilians, and has cost the American taxpayers an estimated $714 billion. Even today, the U.S.-backed Afghan government controls less than 60 percent of its own country — and militant groups such as the Taliban control much of the rest.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

A U.S. soldier points his rifle at a doorway after coming under fire from the Taliban while on patrol in Zharay district in Kandahar province, southern Afghanistan, in 2012. Baz Ratner / Reuters file

'Tried, tested and failed'

Another pillar of Trump's strategy that he announced Monday was his pledge to squeeze neighboring Pakistan, which has long since been accused of harboring militant groups.

"We can no longer be silent about Pakistan’s safe havens for terrorist organizations, the Taliban, and other groups that pose a threat to the region and beyond," he said. "Pakistan has much to gain from partnering with our effort in Afghanistan. It has much to lose by continuing to harbor terrorists."

This line provoked an angry reaction in the country.

"President Trump is banking on a tried, tested and failed strategy," said Mushahid Hussain, a senator in the Pakistani legislature and chairman of the country's Senate Defence Committee.

Hussain asked, if President Barack Obama's "surge" of 100,000 troops didn't work in 2009, why would a bolstered force from Trump be effective?

"For the first time since he became President, Mr. Trump seems to have embraced the traditional Washington/American establishment playbook on Afghanistan," he added. "I was hoping he'd make new mistakes, rather than repeat old ones!"

Sherry Rehman, Pakistan's former ambassador in Washington and a serving senator, said that while Trump's decision "doesn't sound new," his explicit blaming of her country would only "amplify old dogma to new levels."

It also prompted a strongly worded string of tweets from opposition firebrand Imran Khan.

So the US again blames Pak for its deeply flawed & failed Afghan policy stretching over a decade https://t.co/sGikXZb0ay — Imran Khan (@ImranKhanPTI) August 22, 2017

"Vilifying Pakistan appears to be a convenient pillar in the new U.S. policy for Afghanistan," said Maj. Gen. Isfandiyar Pataudi, the former deputy-director general of Pakistan's intelligence agency, the Inter-Services Intelligence, or ISI.

"Pakistan’s sacrifices, and the cost paid in blood and treasure, have been trivialized by the repetitive 'havens and sanctuaries' mantra that is the excuse of choice for failure to bring peace to Afghanistan," he said.

The ISI has long been accused of supporting militants fighting in Afghanistan, a claim Pakistan vehemently denies.

'Very happy'

In Afghanistan itself, however, some people welcomed Trump's renewed commitment.

"I am very happy by Trump’s new strategy," said Abo Zar, a member of the Hazara ethnicity, many of whom are bitter foes of the Taliban which persecuted the group while in power.

"It clearly says that American troops will not leave and will not allow the Taliban to gain power again," said the 24-year-old.

The U.S.-backed Afghan government also embraced Trump's announcement.

"I am grateful to President Trump and the American people for this affirmation of support for our efforts to achieve self-reliance and for our joint struggle to rid the region from the threat of terrorism," said Afghan President Ashraf Ghani. "The U.S.-Afghan partnership is stronger than ever in overcoming the threat of terrorism that threatens us all."

In Kunduz province, which has seen heavy fighting involving the Taliban, 21-year-old student Haji Mohammad Omar said he too was pleased.

"We are happy about this new strategy of U.S." he said. "We are the people who have suffered bloodshed, war and murder for long time."

However, he acknowledged that the U.S. war had so far been unsuccessful.

"We are agree with Trump's strategy for war against terrorism by killing the terrorist and extremist groups. But we have witnessed 16 years of war, of U.S. in Afghanistan, and we haven't seen a positive impact for the life of Afghans ... However we are still optimistic for this strategy."

Mushtaq Yusufzai reported from Peshawar, Pakistan, Wajahat S. Khan reported from Lahore, Pakistan, Ahmed Mengli reported from Istanbul, and Alexander Smith reported from London.