“This show of good will is a positive signal for the U.S.-North Korean summit because it reflects a willingness to negotiate and compromise,” said Lee Byong-chul, senior fellow at the Institute for Peace and Cooperation in Seoul. “It also delivers a political score for the scandal-ridden President Trump at home, giving him something to brag about.”

Senator Edward J. Markey, a Massachusetts Democrat who serves on the Foreign Relations Committee, said in a statement that the release of the three men was a “positive step.”

Their return “removes an obstacle to a successful summit between President Trump and Kim Jong-un,” he said. “Their release before the meeting also demonstrates that the combination of pressure and direct engagement is critical for making progress with North Korea.”

The prisoner release extended the turnabout from last year when the two leaders threatened each other with nuclear war. Mr. Kim recently announced that North Korea would stop all nuclear and long-range missile tests and shut down its nuclear test site as gestures of good will.

But unlike those announcements, the release of the three Americans is permanent, and Mr. Kim forfeited a bargaining chip in freeing them. No other Americans are believed to be held prisoner in North Korea.

The United States has persistently demanded the release of the three citizens — Kim Dong-chul, Tony Kim and Kim Hak-song — who were held on charges of committing espionage or unidentified “hostile acts” against North Korea.

The Washington-based Committee for Human Rights in North Korea welcomed the release of the three but urged the North to release other detainees said to be held there, and to shut down its camps for political prisoners.