US detainees Shane Bauer (L) and Joshua Fattal
Iran has sentenced each of two American nationals detained in the country on charges of illegal entry and espionage to eight years in prison, a top judiciary official says.

"The Branch 15 of Tehran's Revolutionary Court has sentenced Shane Michael Bauer and Joshua Felix Fattal each to eight years in prison," Tehran Prosecutor Abbas Jafari Dolatabadi told reporters on Sunday.

He added that the two US detainees have 20 days to appeal against the verdict, ISNA reported.

Tehran prosecutor also noted that the case of Sarah Emily Shourd, who was released in September 2010 on a $500,000 bail, is still open and will be investigated later.

Although Shourd has announced she will not attend the court session, her trial will not run counter to the law, he said.

"She will be put on trial in absentia," Dolatabadi pointed out.

On July 31, the fourth and final trial session to address the charges against the three US nationals was held in the Branch 15 of Tehran's Revolutionary Court behind closed doors without the presence of Shourd.

Bauer, Fattal and Shourd were arrested on Iranian territory in July 2009 after illegally crossing the border from the mountains of northern Iraq's Kurdistan region.

They were later charged with espionage after the Tehran prosecutor found "compelling evidence" that the three US citizens had been cooperating with US intelligence agencies.