Shane Bauer and Josh Fattal were picked up with their traveling companion Sarah Shourd along the Iran-Iraq border in July 2009. Ms. Shourd was released on bail for "humanitarian" reasons a year ago, but all three were charged last month with espionage and illegal entry and sentenced to eight years in prison.

Last year, Ahmadinejad tried to take credit for the release of one of the hikers, Sarah Shourd, which happened just before his visit to the US last year for the UN General Assembly session. The move angered the judiciary, which responded by delaying her release by several days, The Christian Science Monitor reported at the time.

“Ahmadinejad does interfere in the work [of the judiciary and parliament], he comes and announces this woman will be released, and it’s not his job to do that,” says Massoumeh Torfeh, an Iran specialist at the School of Oriental and African Studies at the University of London.

“That problem is related to the fact that Ahmadinejad announced it first, in order to put himself across as a good candidate for talks with the United States. He wanted to say he did it,” she adds. “But the judiciary wants to say, 'It has nothing to do with you, shut up and be quiet, it’s our affair.' ”

Ahmadinejad has clashed with the court over the hikers repeatedly. This summer, he publicly pushed for a lenient sentence for Bauer and Fattal, but the judiciary instead imposed the eight-year prison sentence to prove that it was not subservient to Ahmadinejad's administration, The Christian Science Monitor reported in August.

… The court’s reversal appears to represent more of a message to the president that the court acts independently of his desires and policy objectives than an affirmation of the two men’s guilt, according to analysts inside the Islamic republic.

Coming amid increasing frustration throughout the Iranian government that Mr. Ahmadinejad has overstepped the bounds of his position, the sentencing is also likely designed as a check to the president’s power.

“The judiciary doesn’t want to hand the government any victories or to be dictated to by the government,” says an analyst speaking by phone from Tehran on condition of anonymity.