Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today’s WorldView newsletter.

The United States has been at war in Afghanistan for around 18 years. But when President Trump met Pakistani Prime Minister Imran Khan at the White House on Monday, he made it clear that he believes he could end the conflict in just over a week.

He could have Afghanistan “wiped off the face of the Earth,” he said. The only thing holding him back, he added, was not wanting “to kill 10 million people.”

On Twitter, U.S. Special Representative for Afghanistan Reconciliation Zalmay Khalilzad avoided responding directly to Trump’s shocking remarks, saying instead that in his meeting with Khan, Trump had “reiterated to the world that there is no reasonable military solution to the war in Afghanistan, & that peace must be achieved through a political settlement.”

Khalilzad’s spin didn’t resonate with many Afghans who recoiled at Trump’s jarring comments.

In Kabul, the president’s statements were met with confusion and anger over why Trump would suggest he was capable of killing millions of people while U.S. troops are fighting the Taliban alongside their Afghan counterparts. Afghan President Ashraf Ghani’s spokesman released a statement demanding Trump clarify his remarks, saying that “the Afghan nation has not and will never allow any foreign power to determine its fate.”

Former president Hamid Karzai said in a statement that Trump “is not respecting our lives and human dignity at all,” the New York Times reported. Karzai’s security adviser Rangin Dadfar Spanta told reporters Tuesday that Trump’s remarks amounted to “a terrible, racist political message.”

“There is no need to brag that you can kill 10 million Afghans,” he said.

Experts believe Trump was neither articulating a shift in American policy nor a well thought-out political message but was merely trying to please the person in front of him. In this case, it was Khan.

“The world has become very aware of President Trump’s propensity to say whatever he needs to say at that moment without any serious forethought,” Husain Haqqani, Pakistan’s former ambassador to the United States, told Today’s Worldview.

The comments were particularly frustrating to Afghans, experts said, because they had hoped Trump would see his meeting with Khan as an opportunity to pressure Pakistan on its record as a safe haven for the Taliban and other militants. But it wasn’t the right moment for Trump, who “wanted to underscore the better relations between the U.S. and Pakistan that you have at this point and didn’t want to open up this can of worms,” said Michael Kugelman, deputy director of the Asia program at the Wilson Center.

“I would err on the side of this being an off-the-cuff remark that shouldn’t be taken as any type of reflection of anything approximating policy,” Kugelman said. “In a very bizarre way, I think that this messaging on his part was meant to underscore his commitment to the current policy which is trying to launch a peace process to end the war through nonmilitary means.”

Harun Mir, an Afghan political analyst, told Today’s WorldView that he believed Trump’s remarks about ending the war in Afghanistan “came out of his own mind, his own head” and betrayed his own lack of understanding of the U.S. role in Afghanistan.

“He was trying to make a good impression for Pakistan,” Mir said. “He doesn’t know perhaps that the United States in Afghanistan has a specific mission, which was in the aftermath of 9/11 when Afghans and Americans fought together for a noble cause... denying international terrorists a safe haven in the country.”

“For that reason we are expecting the U.S. administration in general and the military in Kabul to [confirm that] what Trump said is not the U.S. policy in Afghanistan,” he said.

Trump was “going out of his way to say things Khan and his government would want to hear,” Kugelman said. “I understand why Afghans are unhappy but at end of the day the entire point of Khan’s visit was the administration wanted Khan to feel important."

As Washington Post opinion columnist Max Boot wrote this week, Trump “is focused on a pullout from Afghanistan, and he is convinced that if he flatters Pakistan, it will make it possible for the United States to exit ‘with honor,’ as Richard M. Nixon said of the Vietnam War.”

The State Department has previously said Washington hopes to have a peace deal in place by September — even as little concrete progress has been made on a number of key points over the course of seven rounds of peace talks between the United States and the Taliban over the past year. The talks are largely focused on securing a timeline for U.S. troop withdrawal and a permanent cease fire. Throughout the process, the Taliban has refused to meet directly with the Afghan government but agreed to meet with a handful of Afghan officials on the sidelines of discussions with the United States earlier this month under the conditions that they traveled to the talks in a personal capacity — not in their government roles.

During those talks, Taliban and Afghan representatives met and agreed to an unprecedented road map to peace, stressing that civilian casualties be reduced to zero. But even as they discussed the arrangement in Doha, the Taliban launched a number of deadly attacks on civilians in Afghanistan.

Anxiety remains high in Afghanistan that after nearly two decades of conflict following the Taliban being overthrown in 2001, the end result could see the country practically back where it started: with the Taliban back in control of Kabul.

Nazif Shahrani, a professor of Central Asian and Middle Eastern studies at Indiana University, said that Trump’s remarks in front of Khan struck a sensitive chord in Afghanistan because they were seen there as evidence of what Afghans already fear, “that America is not genuinely interested in Afghanistan one way or another.”

Want smart analysis of the most important news in your inbox every weekday along with other global reads, interesting ideas and opinions to know? Sign up for the Today’s WorldView newsletter.