North Korea pardoned and released two detained American journalists after former president Bill Clinton met in Pyongyang on Tuesday with the country's ailing dictator, a transaction that gives Kim Jong Il a thin slice of the international legitimacy that has long eluded him.

Although the White House and the State Department steadfastly insisted that the former president -- the husband of Secretary of State Hillary Rodham Clinton -- was on a "private humanitarian mission," the trip came about only after weeks of back-channel conversations involving academics, congressional figures, and senior White House and State Department officials, said sources involved in the planning.

North Korea rejected the administration's first choice for the trip -- former vice president Al Gore, who co-founded the television channel that employs the journalists -- and Bill Clinton left the United States only after North Korea provided assurances that the reporters would be released, the sources said.

U.S. officials said they hoped Clinton's trip would give Kim a face-saving way to end North Korea's provocative actions, such as recent missile launches and a second nuclear test, and begin the process of returning to the negotiating table on its nuclear programs. The American effort also appears to have been aided by South Korea's government, which in recent weeks has sought to ease tensions with its neighbor.

In Pyongyang, the official Korean Central News Agency (KCNA) reported that the release of Laura Ling, 32, and Euna Lee, 36, was ordered after Kim issued a "special pardon." The two had been sentenced to 12 years of hard labor after they were captured in March near the Chinese border while making a documentary about the trafficking of North Korean women to China.

The journalists and Clinton left North Korea on a plane en route to Los Angeles, where the women were to be reunited with their families.

"Clinton expressed words of sincere apology to Kim Jong Il for the hostile acts committed by the two American journalists," KCNA reported. "Clinton courteously conveyed to Kim Jong Il an earnest request of the U.S. government to leniently pardon them."

U.S. officials denied late Tuesday night that any apology was offered.

During the visit, Kim hosted a banquet in Clinton's honor, and U.S. officials said the men held talks that lasted more than three hours. State media broadcast images showing a dour-looking Clinton and a smiling Kim. And the KCNA report summarizing the trip was remarkably positive, speaking of "building the bilateral confidence" and "improving the relations between the two countries."

Ling and Lee were in many ways pawns in a test of wills between North Korea and the United States. After their sentencing in June, North Korea reportedly kept them in a guesthouse near Pyongyang, allowing them to make occasional phone calls to relatives in the United States. The sentence to hard labor was not carried out.

North Korea had long made it clear that it expected a high-profile visit on behalf of the journalists, but Gore may not have been acceptable because he was viewed as their boss and thus not an appropriate symbol of the United States. Other potential envoys considered by the administration included Senate Foreign Relations Committee Chairman John F. Kerry (D-Mass.), New Mexico Gov. Bill Richardson (D) and a former ambassador to South Korea, Donald Gregg.

The discreet discussions to secure the women's release continued even as Hillary Clinton slammed North Korea last month, saying it had "no friends" and was acting like an unruly child. But in critical ways, she also moderated her tone with regard to the case, moving from declaring in June that the charges were "absolutely without merit or foundation" to saying last month that the journalists "are deeply regretful, and we are very sorry it's happened."

Some officials said the success of former president Clinton's trip could result in the first U.S.-North Korea bilateral meeting of the Obama administration. They also think the United States will have a somewhat stronger hand because China for the first time has backed tougher sanctions in the wake of North Korea's May nuclear test.

No government officials appeared to be aboard Clinton's plane, but the nature of the delegation gave the mission a quasi-official status. It included John Podesta, Clinton's White House chief of staff, who served as chief of Obama's transition team and is president of the Center for American Progress. Also seen in photos released by the Korean media were David Straub, a former head of the Korea desk at the State Department who is now at Stanford University; longtime Clinton aide Douglas J. Band; and Justin Cooper, who has worked with the William J. Clinton Foundation.

It is not clear who funded the trip. News of Podesta's role came as a surprise to staffers at the Center for American Progress; he was thought to be on vacation in Truckee, Calif. Colleagues of Straub's at Stanford were also surprised.

Clinton and his party were greeted early Tuesday at an airport in Pyongyang, the capital, by Yang Hyong Sop, vice president of the presidium of the Supreme People's Assembly, and by Vice Foreign Minister Kim Kye Gwan, according to KCNA. Kim is the chief nuclear negotiator for North Korea, suggesting that Pyongyang hoped to use the visit to make progress on the impasse over its nuclear weapons program.

The visit offered the United States its first direct look at the increasingly frail-looking Kim Jong Il, 67, who is thought to have suffered a stroke a year ago and whose health has triggered speculation that he has picked his third son to take over Asia's only communist dynasty.

"One of the most beneficial things that could come of this is that smart American observers can describe how sharp he is, how lucid he sounds," said Robert Carlin, a former U.S. intelligence analyst who has made nearly 30 visits to North Korea and is dubious about reports of a succession crisis. "It might put to rest a lot of garbage rumors."

The most senior U.S. official previously to have met Kim was then-Secretary of State Madeleine K. Albright in 2000, who traveled to Pyongyang aiming to arrange a presidential visit by Clinton. That visit did not take place as he turned his concentration to faltering Israeli-Palestinian peace talks in the waning days of his presidency. "The visit that never happened has now happened," said a source involved in the talks with North Korea, noting that the meeting could help fill a gap in Kim's perceived legacy.

Special correspondent Stella Kim in Seoul, correspondent Blaine Harden in Seattle and staff writer Garance Franke-Ruta in Washington contributed to this report.