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

SEOUL, South Korea — The leaders of North and South Korea signed a historic declaration on Friday pledging "no more war" and a common goal of the "complete denuclearization" of the Korean Peninsula.

The countries, which technically remain in a state of war, heralded the deal as part of "a new era of peace."

North Korea's Kim Jong Un and South Korean President Moon Jae-in also vowed to "cease all hostile acts" and to "transform the Demilitarized Zone into a peace zone."

The two leaders embraced, and Moon said he would visit Pyongyang in the fall.

While light on details, the summit laid the foundation for a meeting between Kim and President Donald Trump, amid concerns about North Korea's nuclear program. Kim has repeatedly threatened to destroy both the U.S and South Korea.

Trump gave the deal a cautious welcome, tweeting that "time will tell" if it leads to an end to nuclear missile tests. "The United States, and all of its GREAT people, should be very proud of what is now taking place," he added.

After a furious year of missile launches and Nuclear testing, a historic meeting between North and South Korea is now taking place. Good things are happening, but only time will tell! — Donald J. Trump (@realDonaldTrump) April 27, 2018

Trump followed with a more emphatic: "KOREAN WAR TO END! The United States, and all of its GREAT people, should be very proud of what is now taking place in Korea!"

The president also gave credit to China — North Korea's most important backer — for the dramatic thaw in relations with the South.

Please do not forget the great help that my good friend, President Xi of China, has given to the United States, particularly at the Border of North Korea. Without him it would have been a much longer, tougher, process! — Donald J. Trump (@realDonaldTrump) April 27, 2018

Defense Secretary James Mattis said Friday that if there is a peace treaty, the U.S. would discuss with its allies and North Korea whether U.S. troops need to remain stationed on the Korean peninsula. "I think for right now we just have to go along with the process," said Mattis. "The diplomats are going to have to go to work now."

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

Earlier, Kim and Moon briefly crossed into each other's countries before a meeting that appeared to mark a turning point in one of the world's most dangerous flashpoints.

Kim stepped across a low concrete military demarcation line separating the rival nations and greeted Moon with smiles and handshakes. As cameras clicked, he took Moon by the hand and invited him to briefly step back into North Korea.

Kim Jong Un and Moon Jae-in cross the military demarcation line at Panmunjom on Friday. AP

“We have a chance to heal the wounds,” Kim told Moon as they sat down for talks at the border truce village of Panmunjom on the South Korean side of the Demilitarized Zone.

Kim then wrote a promise in a ceremonial book: "A new history begins now."

After breaking off for lunch, the leaders met again to plant a commemorative pine tree and strolled together through the village without aides.

Kim made an unconventional attempt to break the ice with a comment about his recent missile tests, according to a briefing to reporters by Moon’s spokesman, Yoon Young Chan.

Kim said to Moon with a smile: “I was told that you used to be unable to get a good night’s sleep, being awakened … to attend the National Security Council meetings because of us.”

The North Korean leader added: “I’ll make sure that you can sleep soundly.”

In the first meeting between North and South leaders in a decade, Kim also said that he looks forward to "making the most of this opportunity so that we have the chance to heal the wounds between the North and the South. Let’s meet more often from now on."

He added: “Let’s meet people’s expectations to make a better world. I promise we will do well in the future.”

According to Yoon, Kim also told Moon: “I came here to put an end to the history of confrontation as well as to work shoulder to shoulder with you to tackle the obstacles between us. I came to with the confidence that a brighter future awaits us.”

Before the declaration was signed, China applauded the leaders for taking a "historic step" toward peace. Foreign Ministry spokeswoman Hua Chunying told reporters in Beijing that China hopes for "new journey of long-term peace and stability on the peninsula."

With North Korea’s nuclear weapons program having reached what American policymakers describe as a critical stage, expectations are high that Friday's talks will lay the foundation for reduced tensions between Pyongyang and Washington.

The proposed meeting between Kim and Trump would be the first between a sitting U.S. president and a North Korean leader. It is not clear when it would take place, although American officials have said it could be in late May to mid-June. Singapore, Switzerland, Sweden and Mongolia have all been cited as possible venues.

White House press secretary Sarah Huckabee Sanders said in a statement that the U.S. "looks forward to continuing robust discussions in preparation for the planned meeting between President Donald Trump and Kim Jong Un in the coming weeks."

Meetings between leaders of the two Koreas have occurred in the past, in 2000 and 2007, but in each of those instances the South Korean president traveled to Pyongyang.

Friday's summit comes after last week's news that Mike Pompeo, then CIA director, recently held one-on-one talks with the reclusive strongman. The U.S. Senate on Thursday confirmed Pompeo as Trump's new secretary of state.

Kim also gave his younger sister, Kim Yo Jong, a place at the negotiating table, The Associated Press reported. She sat beside Kim as he started his first round of talks. The only other North Korean official present was former intelligence chief Kim Yong Chol, the top official in charge of relations with the South.

Diplomatic efforts waned late last year amid Trump’s war of words with Kim. He warned that Kim would be met with "fire and fury" and dubbed him "little rocket man."

However, earlier this year, South Korea made some breakthroughs with its warring neighbor after a series of meetings and discussions that resulted in North Korea's sending athletes to compete in the Winter Olympics in South Korea.

Athletes from the two countries entered the Olympic arena in PyeongChang under a unified flag, signaling the potential for warmer ties.

Mac William Bishop and Stella Kim reported from Seoul, Alastair Jamieson and Jason Cumming reported from London.