PANMUNJOM, Korea (AP) — With wide grins and a historic handshake, President Donald Trump and North Korea’s Kim Jong Un met at the heavily fortified Demilitarized Zone on Sunday and agreed to revive talks on the pariah nation’s nuclear program. Trump, pressing his bid for a legacy-defining accord, became the first sitting American leader to walk with Kim into North Korea.

What originally was intended to be an impromptu exchange of pleasantries turned into a 50-minute meeting, another historic first in the yearlong rapprochement between the two technically warring nations. It marks a return to face-to-face contact between the leaders after talks broke down during a summit in Vietnam in February. Trump announced afterward that the two nations had agreed to resume discussions in the coming weeks. Significant doubts remain, though, about the future of the negotiations and the North’s willingness to give up its stockpile of nuclear weapons.

In a made-for television moment, the two leaders strode toward one another from opposite sides of the Joint Security Area and shook hands over the raised patch of concrete at the Military Demarcation Line as cameras clicked and photographers jostled to capture the scene. After asking if Kim wanted him to cross, Trump took 10 steps into the North with Kim at his side, before escorting Kim back to the South for a sit-down at Freedom House.

The spectacle marked the latest milestone in two years of roller-coaster diplomacy between the two nations, as personal taunts of “Little Rocket Man” and threats to destroy the other have been ushered out by on-again, off-again talks, professions of love and flowery letters.

“I was proud to step over the line,” Trump told Kim as they met in the building on the South Korean side of the truce village of Panmunjom. “It is a great day for the world.”

Kim hailed the moment, saying of Trump, “I believe this is an expression of his willingness to eliminate all the unfortunate past and open a new future.” He added that he was “surprised” when Trump issued the unorthodox invitation by tweet on Saturday.

What was originally expected to be a brief exchange of pleasantries over the raised line of concrete marking the border between North and South – Trump had said it would last “two minutes” – turned into private talks stretching about 50 minutes. Trump was joined in the Freedom House conversation with Kim by his daughter and son-in-law, Ivanka Trump and Jared Kushner, both senior White House advisers.

Substantive talks between the nations had largely broken down since the last Trump-Kim summit held in February in Vietnam. The North has balked at Trump’s insistence that it give up its weapons before it sees relief from crushing international sanctions. The U.S. has said the North must submit to “complete, verifiable and irreversible denuclearization” before sanctions are lifted.

As he announced the resumptions of talks, Trump told reporters “we’re not looking for speed. We’re looking to get it right.”

He added that economic sanctions on the North would remain, but seemed to move off the administration’s previous rejection of scaling back sanctions in return for piecemeal North Korean concessions, saying, “At some point during the negotiation things can happen.”

Peering into North Korea from atop Observation Post Ouellette, Trump told reporters before he greeted Kim that there has been “tremendous” improvement since his first meeting with the North’s leader in Singapore last year.

Trump claimed the situation used to be marked by “tremendous danger” but “after our first summit, all of the danger went away.”

But the North has yet to provide an accounting of its nuclear stockpile, let alone begin the process of dismantling its arsenal.

The meeting represented a striking acknowledgement by Trump of the authoritarian Kim’s legitimacy over a nation with an abysmal human rights record.

Trump told reporters he invited the North Korean leader to the United States, and potentially even to the White House.

“I would invite him right now,” Trump said, standing next to Kim, who speaking through a translator, reciprocated that it would be an “honor” to invite Trump to the North Korean capital of Pyongyang “at the right time.”

Trump became the first sitting U.S. president to meet with the leader of the isolated nation last year, when they signed an agreement in Singapore to bring the North toward denuclearization.

North Korea’s nuclear threat has not been contained, Richard Haas, president of the New York-based Council on Foreign Relations, tweeted Sunday. Haas added that the threat of conflict has subsided only because “the Trump administration has decided it can live (with) a (North Korean) nuclear program while it pursues the chimera of denuclearization.”

Every president since Ronald Reagan has visited the 1953 armistice line, except for George H.W. Bush, who visited when he was vice president. The show of bravado and support for South Korea, one of America’s closest military allies, has evolved over the years to include binoculars and bomber jackets.

Trump kept to his blue suit and signature red tie but, ever the showman, sought to one-up his predecessors with a Kim meeting.

The leaders met at a time of escalating tensions. While North Korea has not recently tested a long-range missile that could reach the U.S., last month it fired off a series of short-range missiles. Trump has brushed off the significance of those tests, even as his own national security adviser, John Bolton, has said they violated U.N. Security Council resolutions.