After more than two years in Iranian custody, two Americans convicted as spies took their first steps toward home Wednesday as they bounded down from a private jet and into the arms of family for a joyful reunion in the Gulf state of Oman.

The families called this "the best day of our lives," and U.S. President Barack Obama said their release — under a $1-million bail-for-freedom deal — was "wonderful news."

The release capped complicated diplomatic manoeuvres and a week of confusing signals by Iran's leadership on the fate of Josh Fattal and Shane Bauer.

Although the fate of the two gripped America, it was on the periphery of the larger showdowns between Washington and Tehran that include Iran's nuclear program and its ambitions to widen military and political influence in the Middle East and beyond.

But for a moment at least, U.S. officials may be adding words of thanks in addition to their calls for alarm over Iran.

For Tehran, it was a chance to court some goodwill after sending a message of defiance with hard-line justice in the July 2009 arrests of the Americans along the Iran-Iraq border. The Americans always maintained they were innocent hikers.

'Best day of our lives': family statement

"Today can only be described as the best day of our lives," said a statement from their families. "We have waited for nearly 26 months for this moment and the joy and relief we feel at Shane and Josh's long-awaited freedom knows no bounds.

"We now all want nothing more than to wrap Shane and Josh in our arms, catch up on two lost years and make a new beginning, for them and for all of us," the statement added.

The families waited on the tarmac at an airfield near the main international airport in Oman's capital, Muscat. Also returning to Oman was Sarah Shourd, who was arrested with Bauer and Fattal but freed a year ago. She received a marriage proposal from Bauer while in prison.

At about 20 minutes before midnight, Fattal and Bauer — wearing jeans and casual shirts — raced down the steps from the  plane. The men appeared thin, but in good health.

"We're so happy we are free," Fattal told reporters in Oman. The two men made brief statements before leaving the airport with their families.

"Two years in prison is too long," Bauer said.

In many ways, the release was a mirror image of the scene last year when Shourd was freed on $500,000 bail. That deal, too, was mediated by Oman, an Arabian peninsula sultanate with close ties to both Tehran and Washington. A statement from Oman said it hoped the release would lead to better ties between Iran and the U.S.

Freedom-for-bail deal worth $1M US

The two U.S. hikers were arrested in 2009 near the Iran-Iraq border and convicted of spying despite maintaining their innocence. They were released from prison Wednesday and left Tehran after an Iranian court approved a $1-million freedom-for-bail deal.

Masoud Shafiei, the lawyer representing Bauer and Fattal, said paperwork and other procedural requirements to free Shane Bauer and Josh Fattal from Tehran's Evin prison were completed earlier in the day.

The two were reportedly to be released as early as last week, but there were delays in finalizing the bail.

"The case is over," Shafiei said. "The court has ordered that they be freed on bail."

Border crossing a mistake, hikers say

During their court hearings, Bauer, Fattal and Bauer's fiancée, Sarah Shourd, said they were hiking in the mountains of northern Iraq and mistakenly crossed the unmarked border into Iran. Shourd was released on $500,000 bail in September.

In August 2010, the three were sentenced to eight years in prison each — three years for illegally entering the country and five years for spying.

U.S. President Barack Obama has repeatedly denied the three were tied to any U.S. intelligence efforts.

The lengthy detention of Bauer, Fattal and Shourd has added to tensions between Iran and the United States over issues such as Iran's disputed nuclear program.

Shafiei said the bail of $500,000 for each of the men was posted after some last-minute problems in the bank were resolved.

The lawyer told the semi-official Islamic Students News Agency that the government of Oman had paid the bail for Bauer and Fattel, according to the Washington Post. Oman also reportedly paid Shourd's bail.

'Unilateral pardon' angers Iran's judiciary

Omani officials, who spoke on condition of anonymity because of the sensitivity of the issue, declined to comment on the proceedings for the Americans' release. They only said the private plane, sent from Muscat to the Iranian capital last Wednesday, was still in Tehran.

Last week, Iranian President Mahmoud Ahmadinejad told U.S. journalists that Bauer and Fattal would receive a "unilateral pardon" and would be home "within days."

But the following day, Iran’s judiciary, led by Shia Muslim clerics who once supported Ahmadinejad but now oppose him, said Ahmadinejad did not have the authority to free the two men.

On Sunday, the men’s release was delayed again because one of the judges whose signature is required on the bail paperwork was on vacation. Shafiei said he received the second signature Wednesday morning.

Shourd is now living in Oakland, Calif. Bauer, a freelance journalist, grew up in Onamia, Minn., and Fattal, an environmental activist, is from suburban Philadelphia.

With files from The Associated Press