HANOI, Vietnam – President Donald Trump and Kim Jong Un failed to strike a nuclear deal Thursday, abruptly ending their Vietnam summit hours early and leaving the fate of North Korea's nuclear weapons up in the air.

"Sometimes you have to walk," Trump told reporters after two days of meeting with Kim, but he said he hoped that U.S. and North Korean negotiators would keep talking.

Trump said he was not willing to accept Kim's demand that the United States end all economic sanctions on North Korea before it committed to a specific denuclearization plan.

"It was about the sanctions," he said. "We couldn't give up all the sanctions"

Despite the impasse, Trump continued to praise Kim, calling him "quite a guy and quite a character," and saying that there still was a lot of "warmth" in his relationship with a man many regard as a brutal dictator.

Defends Kim on Warmbier

Trump also defended Kim over the death of U.S. college student Otto Warmbier, who died after suffering a massive brain injury while in a North Korean prison.

"I don't believe he knew about it," Trump said of Kim.

The announcement of the collapse Trump's talks with Kim came after the two tamped down expectations for the two-day summit that played out amid ceremony in Vietnam and political turmoil for Trump back in the United States.

Just a few hours before cutting off the talks, Trump predicted that the two leaders would "ultimately have a deal" but said that "doesn’t mean we’re doing it in one day, in one meeting." He again praised Kim for not conducting weapons and missile tests since their first summit in June in Singapore.

Trump had spoken guardedly throughout a morning of meetings with Kim that came just after his former lawyer, Michael Cohen, implicated him in criminal wrongdoing back in the United States.

Kim, taking the unprecedented step of answering a western reporter's question, said "it's too early to say" whether there will be a deal, but "I would not say I’m pessimistic.”

Later, again responding to an American reporter, Kim said he is willing to denuclearize his nation's weapons systems. "If I'm not willing to do that," he said, "I won't be here right now."

"That might be the best answer you’ve ever heard," Trump chimed in.

Little more than an hour later, the White House announced the summit was ending early.

In 2016, the North Koreans detained Warmbier, a University of Virginia student, accusing him of trying to steal a propaganda poster, and sentenced him to 15 years of hard labor without trial.

A year and a half later, he was returned home to his parents in Cincinnati with a massive brain injury that left him blind, deaf and unable to move on his own. He died a few days later.

At a news conference after the Hanoi summit, Trump was asked by a reporter about whether he pressed Kim on the Warmbier case.

"He tells me that he didn't know about it and I will take him at his word," Trump said.

'Program change'

It turned out that the leaders could not bridge the U.S. demand that North Korea provide a specific plan for denuclearization and North Korea's demand that the U.S. end economic sanctions first.

The first word of the impasse came as reporters gathered for a photo opportunity at a Trump-Kim lunch of snow fish and apple foie gras jelly. As the room sat empty, a White House aide came in and announced there had been a "program change."

In addition to a denuclearization deal, the two sides were discussing a declaration to formally end the nearly seven-decade-old Korean War, which is technically still in place because it ended only with an armistice in 1953.

Another topic of conversation between the United States and North Korea was establishing "liaison offices" in each other's capital cities of Washington and Pyongyang. These would not be embassies, but offices the governments could use to communicate with each other.

Those issues also remain undecided.

National security analysts said the sanctions dispute and other outstanding issues should have been worked out well before Trump and Kim arrived in Hanoi. They blamed poor planning for the summit's collapse.

"All sides wanted a deal, but rushed and poorly staffed process may have killed it," said Joe Cirincione, president of Ploughshares Fund, a global security foundation.

The biggest loser, he added, may be South Korea, which is in the crosshairs of North Korea's nuclear weapons and has encouraged the Trump-Kim negotiations. "They must be fearful that stalled progress could lead to a process collapse," Cirincione said.

Olivia Enos, a policy analyst with the Asian Studies Center at The Heritage Foundation in Washington, said Trump could not simply end sanctions without firm commitments from Kim to dismantle his nuclear weapons. She said the Trump team needs to "maintain its maximum pressure strategy" moving forward.

Harry J. Kazianis, director of Korean Studies at the Center for the National Interest, a nonpartisan think tank, said previous summits have broken up, yet countries kept talking. He said he hopes Trump and Kim keep their rhetoric low-key in the weeks and months ahead.

"As long as we don’t go back to the days of 'fire and fury' – and especially no missile tests – there will be time for Washington and Pyongyang to keep taking," Kazianis said.

While in Vietnam, Trump also had to deal with accusations from his former associate, Cohen.

The former attorney and fixer described his ex-client Trump as a "con man," a "cheat" and a "racist." Cohen implicated Trump in potential crimes involving tax returns, campaign finance, and Russian efforts to influence the 2016 election by hacking emails related to Hillary Clinton's campaign.

Trump tweeted that Cohen is a liar looking to protect himself from legal jeopardy.

The Cohen testimony before Congress has to a large extent overshadowed the Trump-Kim summit, the latest act in a relationship that has seen dramatic ups and downs.

From insults to 'fantasy movie'

Not long ago, each leader threatened to destroy the other's country.

Trump once mocked Kim as "Little Rocket Man," but during the summit and even afterward he said they have a great relationship. He has described the North Korean dictator as a "friend."

At Thursday's summit, Trump and Kim could be seen strolling the grounds of the meeting site at the Sofitel Legend Metropole Hotel, an art nouveau classic that opened in 1901 when the French ran Vietnam. During the Vietnam War, Metropole guests used the air raid shelter beneath the building when U.S. bombers attacked.Now the future of the Trump-Kim relationship could change.

U.S. lawmakers like Senate Minority Leader Charles Schumer, D-N.Y., have criticized Trump for his apparent chumminess with Kim, noting that the North Korean leader kills and imprisons his political opponents.

During the summit, Kim told reporters he knows that people have a "skeptical view" of his talks with with Trump – and that following them is "like watching a scene from a fantasy movie."

Contributing: Kim Hjelmgaard and Deirdre Shesgreen.

What we know about North Korea's leader, Kim Jong-un

Follow the money:Trump-Kim summit: Trump hints at economic rewards for North Korea

Business opportunities:Trump touts North Korea's economic potential. Experts say it's an investor's 'nightmare'

More:What do we really know about North Korea? Here are 10 fascinating facts