SINGAPORE — President Donald Trump and North Korea's Kim Jong Un concluded an extraordinary nuclear summit Tuesday by signing a document in which Trump pledged "security guarantees" to the North and Kim reiterated his commitment to "complete denuclearization of the Korean Peninsula."

The leaders also offered lofty promises, with the American president pledged to handle a "very dangerous problem" and Kim forecasting "major change for the world."

The broad agreement was light on specifics, largely reiterating previous public statements and past commitments. It did not include an agreement to take steps toward ending the technical state of warfare between the U.S. and North Korea.

The pair promised in the document to "build a lasting and stable peace regime" on the Korean Peninsula and to repatriate remains of prisoners of war and those missing in action during the Korean War.

News photographers captured photos of the broad, two-page agreement, which was not immediately released by the White House.

The formal document signing followed a series of meetings at a luxury Singapore resort.

Meeting with staged ceremony on a Singapore island, Trump and Kim came together for a summit that seemed just unthinkable months ago, clasping hands in front of a row of alternating U.S. and North Korean flags, holding a one-on-one meeting, additional talks with advisers and a working lunch.

Throughout the summit that could chart the course for historic peace or raise the specter of a growing nuclear threat, both leaders expressed optimism. Kim called the sit-down a "good prelude for peace" and Trump pledged that "working together we will get it taken care of."

At the signing ceremony, Trump said he expected to "meet many times" in the future with Kim. Responding to questions, he said "absolutely" he would invite Kim to the White House.

For his part, Kim hailed the "historic meeting" and said they "decided to leave the past behind."

In a moment that would have never happened in North Korea, reporters began yelling questions to Trump and Kim, including whether they had discussed the case of Otto Warmbier, the American college student who suffered brain damage while in North Korean custody and died in June 2017, days after he was returned home to Ohio.

In the run-up to the meeting, Trump had predicted the two men might strike a nuclear deal or forge a formal end to the Korean War in the course of a single meeting or over several days. But in the hours before the summit, the White House unexpectedly announced Trump would depart Singapore earlier than expected — Tuesday evening — raising questions about whether his aspirations for an ambitious outcome had been scaled back.

The meeting was the first between a sitting U.S. president and a North Korean leader.

Aware that the eyes of the world were on a moment many people never expected to see, Kim said many of those watching would think it was a scene from a "science fiction movie."

After meeting privately and with aides, Trump and Kim moved into the luncheon at a long flower-bedecked table. As they entered, Trump injected some levity to the day's extraordinary events, saying: "Getting a good picture everybody? So we look nice and handsome and thin? Perfect."

Then they dined on beef short rib confit along with sweet and sour crispy pork.

And as they emerged from the meal for a brief stroll together, Trump appeared to delight in showing his North Korean counterpart the interior of "The Beast," the famed U.S. presidential limousine known for its high-tech fortifications.

Critics of the summit leapt at the leaders' handshake and the moonlight stroll Kim took Monday night along the glittering Singapore waterfront, saying it was further evidence that Trump was helping legitimize Kim on the world stage as an equal of the U.S. president. Kim has been accused of horrific rights abuses against his people.

"It's a huge win for Kim Jong Un, who now — if nothing else — has the prestige and propaganda coup of meeting one on one with the president, while armed with a nuclear deterrent," said Michael Kovrig, a northeast Asia specialist at the International Crisis Group in Washington.

Trump responded to such commentary on Twitter, saying: "The fact that I am having a meeting is a major loss for the U.S., say the haters & losers." But he added "our hostages" are back home and testing, research and launches have stopped.

Giving voice to the anticipation felt around the world as the meeting opened, South Korean President Moon Jae-in said Tuesday he "hardly slept" before the summit. Moon and other officials watched the live broadcast of the summit before a South Korean Cabinet meeting in his presidential office

The summit capped a dizzying few days of foreign policy activity for Trump, who shocked U.S. allies over the weekend by using a meeting in Canada of the Group of Seven industrialized economies to alienate America's closest friends in the West. Lashing out over trade practices, Trump lobbed insults at his G-7 host, Canadian Prime Minister Justin Trudeau. Trump left that summit early and, as he flew to Singapore, tweeted that he was yanking the U.S. out of the group's traditional closing statement.

The optimistic summit was a remarkable change in dynamics from less than a year ago, when Trump was threatening "fire and fury" against Kim, who in turn scorned the American president as a "mentally deranged U.S. dotard." Beyond the impact on both leaders' political fortunes, the summit could shape the fate of countless people — the citizens of impoverished North Korea, the tens of millions living in the shadow of the North's nuclear threat, and millions more worldwide.

Alluding to the North's concerns that giving up its nuclear weapons could surrender its primary deterrent to forced regime change, Secretary of State Mike Pompeo told reporters that the U.S. was prepared to take action to provide North Korea with "sufficient certainty" that denuclearization "is not something that ends badly for them."

He would not say whether that included the possibility of withdrawing U.S. troops from the Korean Peninsula, but said the U.S. was "prepared to take what will be security assurances that are different, unique, than America's been willing to provide previously."

The North has faced crippling diplomatic and economic sanctions as it has advanced development of its nuclear and ballistic missile programs. Pompeo held firm to Trump's position that sanctions will remain in place until North Korea denuclearizes — and said they would even increase if diplomatic discussions did not progress positively.

Experts believe the North is close to being able to target the entire U.S. mainland with its nuclear-armed missiles, and while there's deep skepticism that Kim will quickly give up those hard-won nukes, there's also some hope that diplomacy can replace the animosity between the U.S. and the North.