TEHRAN, Iran - The mothers of three American hikers jailed in Iran for 10 months left for home Friday, getting one last chance to embrace their children but failing to secure their immediate release.

In a glimmer of hope, Iran announced that two of its nationals held in Iraq by U.S. forces for years were freed Friday. The release raised the possibility that a behind-the-scenes swap was in the offing or that their release was a gesture of goodwill in an attempt to free the three Americans.

The Iranians' release "may have some diplomatic effect on this case," said the hikers' lawyer, Masoud Shafii.

The United States has said it is not offering a direct swap, and Iranian officials made no public connection between the freed Iranians and the hikers.

The Americans - Sarah Shourd, 31; her boyfriend, Shane Bauer, 27; and Josh Fattal, 27, whose family lives in Elkins Park - were arrested in July along the Iran-Iraq border, and Iran has accused them of espionage. Their families say that the three were simply hiking in Iraq's largely peaceful mountainous northern Kurdish region and that if they crossed the border, it was accidental.

But their detention has become entangled in the confrontation between the United States and Iran. Iranian leaders have repeatedly suggested a link between their jailing and that of a number of Iranians by the United States whose release Tehran demands.

The mothers - Nora Shourd, of California; Cindy Hickey, of Minnesota, and Laura Fattal - had hoped to at least make a face-to-face appeal for their children's release to Iranian leaders, including President Mahmoud Ahmadinejad or the supreme leader, Ayatollah Ali Khamenei.

Shafii said that the mothers "were willing to stay longer" to meet with Iranian officials but that "the conditions were not right."

Instead, they were given two opportunities - one each on Thursday and Friday - to see their children in the high-rise Esteghlal Hotel near Evin prison, where the hikers are being held.

On Friday, the three were brought to their mothers' private rooms for several hours. Afterward, the mothers were driven to the airport and left on a flight to Dubai. Their children were taken back to Evin, witnesses at the hotel told the Associated Press.

Laura Fattal had said before leaving the United States this week for Iran that the mothers' "greatest wish is that we can come home with our kids."

Iran has hinted in the past that it wants to swap the Americans for a number of Iranians held by the United States - including several tried and convicted in the United States over violations of American sanctions on Iran.

Also among them is a nuclear scientist, Shahram Amiri, who disappeared during a visit last year to Saudi Arabia, raising speculation that he defected to the West.

On Thursday, U.S. State Department spokesman P.J. Crowley said in Washington, "We're not contemplating any kind of a prisoner swap" for the three Americans. "But if Iran has questions about any of its citizens and whether we have any information as to their whereabouts, we would be more than happy to receive that diplomatic note and respond to it," Crowley said.

The Iranians who were released from custody in Iraq on Friday were identified as Ahmad Barazandeh and Ali Abdolmaleki. Barazandeh had been held for seven years and Abdolmaleki two years for entering Iraq without a passport, Iran's ambassador to Baghdad said, according to a report on Iranian state TV. Iraqi and U.S. officials in Baghdad could not immediately confirm the report.

Last year, U.S. forces in Iraq freed five Iranians who had been detained since 2007 on suspicion of aiding Shiite militants. Their release came several months after Iran freed Roxana Saberi, an Iranian American journalist who had been arrested in 2009 and accused of espionage.

Iran has said it allowed the hikers' mothers to visit them as a humanitarian gesture, and state TV gave heavy coverage to their first reunion on Thursday. No cameras or media were allowed to cover their second visit on Friday.

Also Friday, the mothers of the five Iranians released by the United States in 2009 were brought to the hotel to meet with the Americans' mothers - and to highlight what Iran touts as a stark difference in how it and the United States treat each other's detainees.

In that meeting, aired in part on state TV, the Iranian women pointedly said that U.S. officials never gave them the chance to see their loved ones while they were held in Iraq. They also maintained that their sons had been mistreated in U.S. custody.