TEHRAN, Iran (AP) — The mothers of three Americans 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 Americans.

The Iranians' release "may have some diplomatic effect on this case," the Americans' lawyer, Masoud Shafii, told The Associated Press.

The U.S. has said it is not offering a direct swap, and Iranian officials made no public connection between the freed Iranians and the Americans.

Sarah Shourd, 31, her boyfriend Shane Bauer, 27, and Josh Fattal, 27, were arrested in July along the Iran-Iraq border, and Iran has accused them of espionage. Their families say 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. Further increasing tensions, the U.S. announced before the mothers' arrival in Tehran that it had support from other major powers for a new set of U.N. sanctions against Iran over its refusal to stop uranium enrichment.

The mothers — Nora Shourd, Cindy Hickey 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 Supreme Leader Ali Khamenei.

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

Instead, they were given two opportunities to see their children in the high-rise Estaghlal hotel near Evin prison, where the Americans were 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 AP.

Iran has hinted in the past that it wants to swap the three Americans for a number Iranians being held by the United States — including several who have been 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 he defected to the West.

On Thursday, U.S. State Department spokesman P.J. Crowley told reporters 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," he said.

The Iranians who were released from custody in Iraq on Friday were identified as Ahmad Barazandeh and Ali Abdolmaleki, who had been held for seven and two years, respectively, 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.

There have been hints of swaps in a past case. In 2009, U.S. forces in Iraq freed five Iranians who had been detained since 2007 on suspicion of aiding Shiite militants, and their release came several months after Iran freed an Iranian-American journalist, Roxana Saberi, who had been arrested in 2009 and accused of espionage.

In another possible swap, Iran this month freed a 24-year-old French academic, Clotilde Reiss, arrested 10 months ago in connection with Iran's crackdown on postelection protests. Just before her release, Paris freed an Iranian detained in France on a U.S. warrant over suspicions of buying technology for Iran's military. And soon after Reiss' release, France also set free an Iranian imprisoned for the 1991 assassination of a former Iranian prime minister.

Iran has said it allowed the mothers to visit the Americans as a humanitarian gesture, and state TV gave heavy coverage to the mother's first reunion with their children Thursday. They embraced, kissed and cried, then sat for a lavish meal in the hotel restaurant. It was the first public look at the three young Americans since their detention.

Josh Fattal told reporters, "We hope we're going home soon, maybe with our mothers." They appeared healthy, wearing jeans and polo-style shirts. Sarah Shourd wore a maroon-colored head scarf. They described their routines behind bars and the small things that take on major significance: being allowed books, letters from home, the ability to exercise and the one hour each day they are all together. The last direct contact with their families was a five-minute phone call in March.

On Friday, the mothers of the five Iranians released by the U.S. 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 U.S. treat each others' detainees.

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

Hickey lives in Minnesota, Shourd is from Oakland, California, and Fattal is from suburban Philadelphia.