TEHRAN (CBS SF) – Two University of California at Berkeley graduates who have been detained in Iran on espionage charges for more than two years were finally released Wednesday, according to their families.

Shane Bauer and Josh Fattal, both 29, and a third UC Berkeley graduate, Sarah Shourd, were arrested on July 31, 2009, after embarking on a hike in Iraq’s Kurdistan region near the Iranian border.

Iran accused all three of them of espionage and last month Bauer and Fattal were sentenced to eight years in prison. But the hikers and their families said they aren’t spies but instead were detained after they accidentally crossed an unmarked border into Iran.

KCBS’ Holly Quan Reports:

Iran released Shourd, 32, who is engaged to Bauer, last September because she was in poor health. Shourd announced in May that she would not return to Iran for a trial because she is suffering from depression and post-traumatic stress disorder.

Shourd and family members of Bauer and Fattal greeted the two men in Muscat, Oman, when they arrived there after being released and flown out of Iran, according to a statement issued by the three families.

The families said, “Today can only be described as the best day of our lives. 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.”

They said, “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 families thanked the Sultan of Oman, Qaboos bin Said Al Said of Oman and his envoy Dr. Salem Al Ismaily, for their roles in securing the release of Bauer and Fattal.

They also thanked the hikers’ lawyer, Masoud Shafii, and the Swiss Ambassador to Iran, Livia Leu Agosti. The Swiss Embassy in Iran acted as a liaison between the U.S. and Iran because the two countries don’t have diplomatic relations.

U.S. Senator Barbara Boxer, D-Calif., said in a statement, “It is so wonderful that Shane and Josh are finally coming home to be reunited with their loved ones. But I deeply regret that their release has taken so long. Shane and Josh have been forced to pay too great a price by the Iranian government.”

The Council on American-Islamic Relations, a Muslim advocacy group, issued a statement today welcoming the release of the pair but said the U.S. government should now “address the issue of Iranian citizens detained in the U.S. with the same spirit of compassion that resulted in the release of Shane Bauer and Josh Fattal.”

Iran’s state news agency IRNA said Bauer and Fattal left Iran just as darkness fell in the capital.

The case of Bauer and Fattal, who were convicted by an Iranian court of spying for the United States, has deepened strains in the already fraught relationship between Washington and Tehran. Iranian President Mahmoud Ahmadinejad, who was first to mention last week that the Americans’ could be released, is in the United States and is scheduled to speak at the United Nations General Assembly on Thursday.

The release came just minutes before President Barack Obama addressed the U.N. General Assembly. There was no direct evidence that Iran timed the American’s freedom to overshadow Obama’s speech, but Iran has conducted international political stagecraft in the past.

Most famously, Iran waited until just moments after Ronald Reagan’s presidential inauguration in January 1981 to free 52 American hostages held for 444 days at the former U.S. Embassy after it was stormed by militants backing Iran’s Islamic Revolution. The timing was seen as a way to embarrass ex-President Jimmy Carter for his backing of Iran’s former monarch.

Switzerland represents American interests in Iran because the U.S. has no diplomatic relations with Tehran and the prisoners are expected to be flown to Oman now.

The two men, both 29, were driven out of the prison compound just minutes after their Iranian attorney, Masoud Shafiei, said he has completed the paperwork for their release.

“I have finished the job that I had to do as their lawyer,” Shafiei said. He obtained signatures of two judges on a bail-for-freedom deal. A $1 million bail — $500,000 for each one— was posted.

Police vehicles escorted the convoy of Swiss and Omani vehicles, carrying the two Americans to Mehrabad airport, which was once Tehran’s main gateway to the world but is now used for domestic flights. The airport is near the massive Azadi Square, which Iran uses to hold military parades but also was a temporary hub for protesters after Ahmadinejad’s disputed re-election in 2009.

The London-based rights group Amnesty International called the release of the Americans a “long overdue step.”

“Iranian authorities have finally seen sense” and have agreed to release Shane Bauer and Josh Fattal, said Hassiba Hadj Sahraoui, Amnesty International Deputy Director for Middle East and North Africa. “They must now be allowed to leave Iran promptly to be reunited with their families.”

The three Americans—friends from their days at Cal—have maintained their innocence and denied the espionage charges against them.

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.

Phone messages left for Fattal’s mother and brother in Philadelphia were not immediately returned Wednesday.

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

Bauer proposed marriage to Shourd while in prison. After her release last September, Shourd was flown on a private plane to the Omani capital, Muscat.

Last week, Oman again dispatched a plane belonging to the Gulf country’s ruler to the Iranian capital to fetch the two men if the freedom-for-bail was reached.

Oman has close ties with both Tehran and Washington and plays a strategic role in the region by sharing control with Iran of the Strait of Hormuz at the mouth of the Persian Gulf, which is the route for 40 percent of the world’s oil tanker traffic.

Their case of the three Americans closely parallels that of freelance journalist Roxana Saberi, an Iranian-American who convicted of spying before being released in May 2009. Saberi was sentenced to eight years in prison, but an appeals court reduced that to a two-year suspended sentence and let her return to the U.S.

In May 2009, a French academic, Clotilde Reiss, also was freed after her 10-year sentence on espionage-related charges was commuted.

Last year, Iran freed an Iranian-American businessman, Reza Taghavi, who was held for 29 months for alleged links to a bombing in the southern city of Shiraz, which killed 14 people. Taghavi denied any role in the attack.

The possible release of the two Americans would remove one point of tension between Iran and the United States, but suspicions still exist on both sides and no thaw is in sight.

Washington and European allies worry Iran is using its civilian nuclear program as cover to develop atomic weapons and have urged for even stronger sanctions to pressure Tehran. Iran denies any efforts to make nuclear weapons.

Iran, meanwhile, is deeply concerned about the U.S. military on its borders in Iraq and Afghanistan, and sharply denounces U.S. influence in the Middle East.

(Copyright 2011 by CBS San Francisco. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.)

Firstly, thank the US and Iran people for resolving this. Lastly, it’s sad when highly educated (CAL) graduates decide to exercise their American freedom abroad and have to deal with the realities of other countries. After millions of dollars spent on this ordeal, while the money could’ve been spent on other important needs, like bettering teachers and schools facilities, hopefully the lesson we learn or should remember in all of this is that we do have certain unalienable rights, only in certain geographies.

Silly question… “why would the US put up a million dollars ‘bail’ to free two Americans who where just hiking”? This smells like a week old kettle of fish… they were spying and got caught and the the US paid to get them back and to keep their mouths shut.

As for “tn” your American Freedom does you no good in Iran, Iraq or Germany for that matter. When in someone else’s court you play by their rules… simple, but amazing the number of Americans who get their noses out of joint when something doesn’t go their way.

Soonerdiver is correct. I have worked in several third world countries. The only reasons anyone (other than an unbelievable goofball) goes near a sensitive border is for drugs, sex, money or intelligence.