Sarah Shourd could be released in the "next two or three days" - or even sooner - after $500,000 bail is paid, said Masoud Shafiei, the Iranian lawyer for Shourd and the other detained Americans, Shane Bauer and Josh Fattal.
President Mahmoud Ahmadinejad had personally promised Shourd's release on Friday as a sign of Islamic compassion at the end of the holy month of Ramadan but was quickly slammed down by the judiciary - which turned around Sunday and set its own ground rules, including the bail amount. Swiss diplomats, who represent U.S. interests in Iran because the two countries do not have direct diplomatic relations, were making arrangements to post bail.
"Based on the judiciary decision, the lady will be released," Foreign Minister Manouchehr Mottaki said at a news conference.
But as Iranian authorities paved the way for Shourd's release on health grounds, they also appeared to be moving their espionage accusations into high gear. Tehran's chief prosecutor Abbas Jafari Dowlatabadi said indictments against the three Americans were issued Sunday and the prosecution's case is nearly complete.
That could mean trials for Bauer and Fattal, both 28, and proceedings in absentia for Shourd, 32. Convictions could bring prison sentences of up to 10 years each.
"The suspects did not confess, but we have enough reasons in hand for their spying charges," Dowlatabadi said.
Iran has accused the three of illegally crossing the border and spying in a case that has deepened tensions with Washington - which has led the push for tougher sanctions on Iran over its nuclear program. The detainees' families say they were hiking in Iraq's scenic north when they were detained on July 31, 2009, and that if they crossed the border, they did so unwittingly.
Dowlatabadi claimed the Americans had "equipment and documents and received training." He did not elaborate.
"They had not come to Iraq and Iran for entertainment," Dowlatabadi was quoted as saying by the official IRNA news agency.
Shafiei, the lawyer for the detained Americans, told The Associated Press that they were fine when he visited them for about three hours Sunday. He said it was the first face-to-face meeting allowed since he was hired by their families to represent them in late 2009.
The three are being held at Tehran's Evin Prison, which also holds hundreds of opposition activists and others arrested in the crackdown after last year's disputed presidential election.
Shourd "was naturally very happy, and even the two male prisoners were glad about Sarah's freedom. But Sarah had expected all three of them to be released," the lawyer later told AP Television News.
Shourd's mother has said her daughter has been denied treatment for serious health problems, including a breast lump and precancerous cervical cells. Nora Shourd, of Oakland, California, could not be reached for comment Sunday.
"We're just keeping an eye on the situation and we have no further comment," said Samantha Topping, a New York publicist working with the families.
Dowlatabadi said the conditions of Shourd's bail do not bar her from leaving the country - a situation similar to that of Canadian-Iranian journalist Maziar Bahari of Newsweek, who was allowed pretrial bail last year, left Iran and was later convicted in absentia.
The provisions of Shourd's bail have not been disclosed, but it's unlikely she would face a demand to return for a possible trial. At the same time, any comments or criticisms she makes could be closely watched by Iranian authorities who still have custody of her two friends.
Dowlatabadi said the bail arrangements are being handled through the Swiss Embassy.
"Based on reports and the approval of the relevant judge about the sickness of Ms. Shourd, her detention was converted to $500,000 bail, and if the bail is deposited, she can be released," IRNA quoted the prosecutor as saying.
The semiofficial ISNA news agency quoted the Swiss ambassador to Tehran, Livia Leu Agosti, as saying she was "very hopeful that she will be released as soon as possible." She refused to give further details, said ISNA.
It was not immediately clear whether such a bail payment would violate U.S. trade sanctions against Iran and whether a special waiver would be required.
"We are working and hoping for the release of all three hikers," U.S. State Department spokesman P.J. Crowley said.
In the past, Ahmadinejad has suggested the three Americans could be traded for Iranians claimed to be held by the U.S., raising the possibility they could still be seen as bargaining chips by Tehran.
Dowlatabadi rejected any link between the decision to grant Shourd bail and the return to Iran in July of nuclear scientist Shahram Amiri. Iran had accused the U.S. of abducting Amiri, while Washington said he was a willing defector who later changed his mind.
Allowing an exit for Shourd capped a seesaw spectacle that exposed power struggles between Iran's president and its powerful courts.
On Friday, the Foreign Ministry announced that Ahmadinejad had arranged Shourd's planned release on Saturday to coincide with the end of Ramadan and show the "special viewpoint of the Islamic Republic of Iran on the dignity of women."
Hours later, judiciary officials said the release was off - an embarrassing slap to Ahmadinejad. On Saturday, Dowlatabadi emphasized that any announcement about the American's release "would only come through the judiciary system."
Meir Javedanfar, an Iranian-born political analyst based in Israel, said the judiciary allowed the Shourd release to move ahead only after being sure "Ahmadinejad has understood the message" about trying to encroach on the court's authority.
At times, Iran has also exploited the propaganda value of holding the three Americans.
In May, for example, Iran allowed the mothers of the three detainees to visit them, releasing them temporarily from Evin prison for an emotional reunion at a hotel. The elaborate event received extensive coverage on the government's main English-language broadcast arm.
In the past year, Iranian authorities have allowed bail or converted jail sentences to fines for two other high-profile detainees.
In May, French academic Clotilde Reiss was freed after her 10-year sentence on espionage-related charges was commuted to a fine equivalent to $300,000.
The Newsweek journalist Bahari was freed on $300,000 bail in October 2009 after nearly four months detention following the crackdown after the country's disputed presidential election. He was later sentenced in absentia to more than 13 years in prison and 50 lashes.
Murphy reported from Dubai, United Arab Emirates. Associated Press Writer Patrick Condon in Minneapolis contributed to this report.