Iranian President Mahmoud Ahmadinejad announced on Tuesday that he will release and unconditionally pardon Shane Bauer and Josh Fattal, two U.S. hikers who accidentally wandered into Iran from Iraq in 2009. The two were arrested, convicted of spying, and recently sentenced to eight years in prison. Ahmadinejad called the release a "humanitarian gesture," while an Iranian court set bail of $500,000 each for the men. (Sarah Shourd, a third hiker who was arrested, was released last year under a similar bail arrangement.) Why is Iran releasing the men now? Here, three theories:

1. Iran is saving face ahead of Ahmadinejad's U.N. visit
The Iranian president is scheduled to attend the United Nations General Assembly in New York next week, says Ladane Nasseri at Bloomberg Businessweek, and Iran may have timed the hikers' release as a strategic PR move ahead of that visit. There's a precedent for this theory, says the Associated Press. Shourd's release last year came "just as Ahmadinejad was heading for the annual gathering of world leaders."

2. Iran knows the charges were "preposterous" to begin with
This could be an acknowledgement (finally!) that the charges against Bauer and Fattal were unfounded, says Esther Kaplan at The Investigative Fund, where Bauer had been a reporter before his detention. Evidence corroborated by two local witnesses suggests that the hikers "did not actually cross into Iran until armed soldiers gestured for them to leave their hiking trail and approach." Hardly the work of spies.

3. This is the final act in a complex Iranian plan
The eight-year jail sentences handed down last month came as a surprise to analysts who heard from Iranian officials that the Americans could be released soon, "perhaps as a humanitarian gesture," says Neil MacFarquhar and Artin Afkhami at The New York Times. Iran seemed eager to end this saga, thanks to the negative publicity created by "all the attention focused on the distressed mothers of the men." Some analysts believe that even during the sentencing, Iran may have been planning to still make a "humanitarian gesture in releasing" the hikers. By that logic, the harsher-than-expected sentences last month would make the hikers' subsequent release appear "all the more magnanimous."