Updated

The lawyer for two Americans jailed as spies in Iran was back in court Tuesday seeking a second judge's signature on a bail deal that could free them after more than two years behind bars.

Shane Bauer and Josh Fattal were detained along the Iran-Iraq border in 2009 and were convicted last month of spying for the United States in a case that has deepened the mistrust between Washington and Tehran. President Mahmoud Ahmadinejad raised hopes a week ago that the men, both 29 years old, could be released in a matter of days in what he described as a humanitarian gesture.

But months of internal political battles between Ahmadinejad and his rivals in the clerical leadership and the judiciary appear to be holding up the possible deal to lift the men's eight-year prison sentences and free them on bail of $500,000 each.

The official explanation for the latest snag was that a second judge whose signature is required on the bail papers was on vacation until Tuesday, their Iranian attorney has said.

Masoud Shafiei told The Associated Press Tuesday he was back in court awaiting the judge's return.
"After what I was told two days ago, I went to the court again today, but the judge who should sign has not turned up yet," Shafiei said.

A similar tussle between Iran's president and his rivals also initially held up a deal to release another American arrested with the men, their friend Sarah Shourd. She was freed in a similar bail deal last September with help from mediators from the Gulf nation of Oman.

A delegation of U.S. Christian and Muslim leaders returned from Iran Monday disappointed they could not immediately secure the release of the two Americans still in custody. However, they were optimistic their release was imminent.

Bauer and Fattal deny wrongdoing. Their families say the three Americans were just hiking in northern Iraq's scenic and relatively peaceful Kurdish region when they may have accidentally strayed over the unmarked border.

Ahmadinejad appeared to have been trying to get the Americans released in time for his arrival at the U.N. General Assembly in New York on Monday. The president's rivals, who control Iran's courts, might be seeking to hold up the deal in part to deprive him of the chance to claim credit on the world stage for the release of the Americans.

U.S. Secretary of State Hillary Rodham Clinton said Thursday the United States continues to hope the Americans will be released, adding that Washington has received word through a number of sources that the two will be returned to their families.

The last direct contact family members had with Bauer and Fattal was in May 2010 when their mothers were permitted a short visit in Tehran.

Since her release last year, Shourd has lived in Oakland, California. Bauer, a freelance journalist, grew up in Onamia, Minnesota, and Fattal, an environmental activist, is from suburban Philadelphia.

Bauer proposed marriage to Shourd while in prison.