SEOUL, South Korea — The leaders of North and South Korea agreed on Friday to work to remove all nuclear weapons from the Korean Peninsula and, within the year, declare an official end to the Korean War that ravaged the two nations from 1950 to 1953.
At a historic summit meeting, the first time a North Korean leader had ever set foot in the South, the leaders vowed to negotiate a peace treaty to replace a truce that has kept an uneasy peace on the divided Korean Peninsula for more than six decades, while ridding it of nuclear weapons.
“South and North Korea confirmed the common goal of realizing, through complete denuclearization, a nuclear-free Korean Peninsula,” read a statement signed by North Korea’s leader, Kim Jong-un, and the South’s president, Moon Jae-in, after their meeting at the border village of Panmunjom.
The meeting between Mr. Kim and Mr. Moon was marked by some surprisingly candid moments but also sweeping pledges, with Mr. Kim saying, “I came here to put an end to the history of confrontation.”
The event, at the Peace House, a conference building on the South Korean side of Panmunjom, was closely watched because it could set the tone for the even more critical summit meeting between President Trump and Mr. Kim, two leaders known for bold if unpredictable actions who only recently had the world fearing a nuclear war.
Mr. Trump and his aides are expected to seek a quick timetable for the North to eliminate its nuclear weapons. But Friday’s agreement between Mr. Moon and Mr. Kim was short on such specifics.
“The South and the North agreed to work diligently to win the international community’s support and cooperation for the denuclearization of the Korean Peninsula,” their statement said.
The tone of the session — broadcast live nationally on South Korean television — was convivial and at times jocular, with Mr. Kim showing surprising honesty about the differences in conditions between the two nations.
Yoon Young-chan, Mr. Moon’s spokesman, said Mr. Kim acknowledged the poor road conditions in his country, a startling admission for a member of his ruling family, which is considered godlike and faultless among North Koreans. Mr. Kim also revealed that the North Koreans who visited the South during the Winter Olympics in February all admired the bullet train there.
After Mr. Moon spoke of wanting to visit North Korea, Mr. Kim said, “It will be very embarrassing,” alluding to the roads in his country.
Mr. Kim also repeated a lighthearted line he had used in his meeting with South Korean envoys in Pyongyang, the North Korean capital, last month, apologizing to Mr. Moon for disturbing his sleep with missile tests and forcing him to attend meetings of his National Security Council.
“I heard you had your early morning sleep disturbed many times because you had to attend the N.S.C. meetings because of us,” Mr. Kim said. “Getting up early in the morning must have become a habit for you. I will make sure that your morning sleep won’t be disturbed.”
Mr. Moon joked back: “Now I can sleep in peace.”
Mr. Moon also offered some capitalistic carrots, reminding Mr. Kim that South Korea had in years past promised huge investments to help improve the North’s road and train systems. Those agreements eventually collapsed as the North persisted in developing nuclear weapons.
Mr. Moon, a progressive leader who says he likes to see South Korea “in the driver’s seat” in pushing the peace effort forward, is trying to broker a successful summit meeting between Mr. Kim and Mr. Trump, which is expected in late May or early June.
Mr. Kim rattled the region last year by testing long-range missiles and trading threats of nuclear war with Mr. Trump. But then Mr. Kim shifted gears, saying that he was willing to give up his nuclear weapons for the right incentives and proposing the meeting with Mr. Trump.
Last weekend, Mr. Kim announced an end to all nuclear and long-range-missile tests, saying that his country had mastered how to mount nuclear warheads on missiles and no longer needs to conduct tests. Mr. Kim said North Korea has adopted a “new strategic line” focusing on economic development.
Skeptics say Mr. Kim is trying to improve ties with South Korea to steer it from the United States and escape sanctions that are increasingly hurting the North’s economy. Indeed, many conservatives in the South fear that the North’s goal remains to be accepted as a nuclear power in return for freezing its nuclear and intercontinental-ballistic-missile programs.
Analysts have warned that once negotiations begin with the United States, North Korea could push them into a stalemate by trying to drag Washington into nuclear arms reduction talks.
To prevent that, South Korea and the United States are trying to persuade North Korea to agree to a specific timeline for complete denuclearization: as soon as possible and no later than the end of Mr. Trump’s current term, in early 2021, according to South Korean officials and analysts.
During their morning talks, Mr. Kim suggested more summit meetings with Mr. Moon, saying that he would like to visit the presidential Blue House in Seoul. He said North Korea would cooperate to make a “better world.”
But he also voiced caution, suggesting South Korea and the United States deserved blame for scuttling previous deals.
“As the expectations are high, so is the skepticism,” he said. “In the past, we had reached big agreements, but they were not implemented for more than 10 years. There are people who are skeptical that the results of today’s meeting will be properly implemented.”