Roxana Saberi, the 32-year-old Iranian-American journalist convicted of espionage in Iran has been released to her family, and will soon return to the United States.

While her international community of family, colleagues and friends can rejoice in her release, it was predictable from the moment of her arrest, based on the history of such events in Iran in the past.

Although no one will know for sure exactly how events proceeded against her, it is possible to speculate how Saberiâ€™s arraignment and trial developed.

The espionage charges against Saberi were utterly unfounded. They were likely the result of an escalation within the Iranian judicial system as official after official tried to cover their tracks for a series of abortive attempts to charge her with a crime.

She was first detained for the relatively minor offense of having purchased a bottle of wine. Since religious minorities in Iran are allowed to manufacture, sell and consume alcohol, the country is awash in liquor. It is easily obtainable by everyoneâ€”even government officials. Most likely the arresting official did not know that Saberi was an American passport holder born in the United States, and was probably chagrined to discover that this case was likely to create international brouhaha.

A more serious charge was then sought to justify the first arrest. The discovery that her press credentials had expired some months earlier provided that opportunity. Saberi had continued to file stories for a number of American news outlets, reportedly because officials assured her that the expiration of her press pass was inconsequential. Since she could demonstrate that Iranian officials had allowed her to continue writing, this charge would also not hold water.

Finally, the serious charge of espionage was lodged. As foolish and unsubstantiated as this charge was, it was plausible in Iran. Rumors that American CIA operatives were active in Iran were widely promulgated in Iran. These suspicions were reinforced through extensive documentation found in New York Times reporter James Risenâ€™s 2006 book â€œState of War.â€ Additionally, on April 4, the Israeli newspaper Haâ€™aretz confirmed an earlier rumor that an Iranian nuclear scientist had been assassinated by the Israeli intelligence agency, Mossad, inside Iran.

Iran experienced one horrendous situation involving a foreigner arrested for spying in Iran in 2003. Canadian-Iranian Zahra Kazemi was raped, beaten and tortured to death (although Iranian authorities claimed she died of a stroke) for allegedly having photographed prohibited parts of Evin Prison, where she was later incarcerated. Her death caused an international uproar. The Iranian government, clearly badly burned by the Kazemi case has since been careful to make sure that her situation is not repeated.

Foreigners — dual nationals — accused of espionage have been held for a time, usually in conspicuously humane circumstances, while the government wrings as much publicity out of the event as possible for a domestic and regional audience. The accused prisoners are then released in a show of clemency.

This was the case with Haleh Esfandiari, director of the Middle East program at the Woodrow Wilson International Center for Scholars in Washington, D.C. Ms. Efandiari was visiting her 90-year-old mother in 2006 when she was arrested. It is likely that her connection to Lee Hamilton, director of the Wilson Center, made her an object of suspicion. Hamilton had long connections to the CIA and to groups promoting democratic revolutions in places like Georgia, Ukraine and Kyrgyzstan.

Kian Tajbakhsh was arrested at about the same time on the same charges. Tajbakhsh worked for George Sorosâ€™ Open Society Institute. Soros had also been active in the same â€œrevolutionsâ€ in the region.

Both Esfandiari and Tajbakhsh were held under relatively humane circumstances and released some months later.

The Iranian presidential election next month was also a likely reason for a quick dispensation of Saberiâ€™s case. Iran would like the world to focus on the election, and not on an ongoing saga of an international journalist in their prison system.

In the Saberi case, Iran actually did itself some good. It showed that it had a functioning judicial systemâ€”however imperfectâ€”with an appeals process that eventually yielded the correct result.

The Obama administration, by engaging in diplomacy and sober statements of concern regarding Saberi, not only aided the process of her release, but likely set the stage for further improved relations between the United States and Iran. We now have a situation where Iran undertook an action of which the United States disapproved. The United States expressed itself in a non-hostile manner, and the Iranian government responded with a positive redress of that action. This bodes well for future U.S.-Iranian relations. It is only regrettable that this had to come at the price of Saberiâ€™s unjust incarceration.

William O. Beeman is professor and chair of the department of anthropology at the University of Minnesota. He is past president of the Middle East section of the American Anthropological Association. He has lived and worked in Iran for more than 30 years. His most recent book is The â€œâ€™Great Satanâ€™ vs. the â€˜Mad Mullahsâ€™: How the United States and Iran Demonize Each Otherâ€ (University of Chicago Press, 2008).