WASHINGTON — President Trump, exulting in the release of three Americans from prison in North Korea, confirmed Thursday that he would meet Kim Jong-un, the North’s leader, in Singapore on June 12, setting the date for a once unimaginable encounter.

The choice of Singapore, a tidy, prosperous city-state with ties to both the United States and North Korea, is a small victory for Mr. Trump’s advisers, who talked him out of meeting Mr. Kim in the Demilitarized Zone between North and South Korea — a far more symbolic, but politically problematic, location.

“We will both try to make it a very special moment for World Peace!” Mr. Trump said in a midmorning post on Twitter, hours after he traveled in the middle of the night to Joint Base Andrews near Washington to greet the three men: Kim Dong-chul, Tony Kim and Kim Hak-song.

North Korea’s release of the Americans lifted a major obstacle to the summit meeting. Secretary of State Mike Pompeo, who has taken charge of the diplomatic opening to the North, finalized its date and location during a 90-minute meeting with Kim Jong-un in Pyongyang, the North’s capital. Afterward, Mr. Pompeo left with the detainees on his plane.