WASHINGTON — After months of trading insults and threats of nuclear annihilation, President Donald Trump agreed to meet with North Korean leader Kim Jung Un by May to negotiate an end to Pyongyang’s nuclear weapons program, South Korean and U.S. officials said Thursday. No American president has ever met with a North Korea leader.

The South Korean national security director, Chung Eui-yong, told reporters outside the White House of the planned summit, after briefing Trump and other top U.S. officials about a rare meeting with Kim in the North Korean capital on Monday.

The meeting would be unprecedented during seven decades of animosity between the U.S. and North Korea. The countries do not even have formal diplomatic relations. They remain in a state of war because the 1950-53 Korean War ended with an armistice and not a peace treaty.

Chung said he had told Trump that Kim says he’s committed to “denuclearization” and has pledged that North Korea will refrain from any further nuclear or missile tests — providing a rare diplomatic opening after a year of escalating tensions over the North’s tests. The rival Koreas have already agreed to hold a leadership summit in late April.

“He (Kim) expressed his eagerness to meet President Trump as soon as possible,” Chung said. “President Trump appreciated the briefing and said he would meet Kim Jong Un by May to achieve permanent denuclearization.”

Chung did not say where Trump would meet with Kim. The White House said Trump’s meeting with Kim would take place “at a place and time to be determined.”

Trump took office vowing to stop North Korea from attaining a nuclear-tipped missile that could reach the U.S. mainland. He’s oscillated between threats and insults directed at Kim, and more conciliatory rhetoric. His more bellicose talk, and Kim’s nuclear and missile tests, have fueled fears of war.

Trump, who has ramped up economic sanctions on North Korea to force it to negotiate on giving up its nukes, has threatened the pariah nation with “fire and fury” if its threats against the U.S. and its allies continued. He has derided Kim by referring to him as “Little Rocket Man.”

After Kim repeated threats against the U.S. in a New Year’s address and mentioned the “nuclear button” on his office desk, Trump responded by tweeting that he has a nuclear button, too, “but it is a much bigger & more powerful one than his, and my Button works!”

On Tuesday after leaving Pyongyang, Chung had publicized that North Korea was offering talks with the United States on denuclearization and normalizing ties, but the proposal for a summit still came as a huge surprise, and will raise questions about whether the two sides are ready for such a high-level meeting.

The drills were suspended during the Winter Olympics recently hosted by South Korea, which provided impetus for the inter-Korea rapprochement. The drills are expected to resume next month. North Korea has long protested the military maneuvers south of the divided Korean Peninsula as a rehearsal for invading the North.

Trump had made a surprise visit to the White House press briefing room on Thursday afternoon to alert reporters to the South Korean announcement. When asked whether the announcement would be about talks with North Korea, he told ABC reporter Jon Karl: “It’s almost beyond that. Hopefully, you will give me credit.”

On Tuesday, Trump had expressed both hope and skepticism about the reported offer of talks, which has yet to be confirmed, at least publicly, by the isolated North Korean government. While the path to a diplomatic resolution over the North’s nuclear arsenal would be long and difficult, talks could dampen fears of war breaking out over what represents an emerging threat to the U.S. mainland.

Just a few hours earlier, U.S. Secretary of State Rex Tillerson, who is traveling in Africa, had said the adversaries were still a long way from holding negotiations.