Two American men arrested more than two years ago while hiking along the Iraq-Iran border have been sentenced to eight years in prison on charges that include espionage, state TV reported Saturday, in an apparent sharp blow to hopes that their release was imminent.

The announcement seems to send a hard-line message from Iran’s judiciary — which answers directly to the ruling clerics — weeks after the country’s foreign minister suggested that the trial of Shane Bauer and Josh Fattal could clear the way for their freedom.

It is also likely to bring added tensions to Iranian President Mahmoud Ahmadinejad’s expected visit to New York next month for the annual General Assembly at the United Nations.

But the report, although carried on Iran’s highly controlled state media, was not immediately confirmed by authorities. Iranian government officials made no further comment, but it is not unusual for Iran to use selected state news outlets to make high-profile announcements.

In Washington, a State Department spokeswoman restated U.S. appeals for their release. “It is time to reunite them with their families,” she said.

The Americans deny the charges and say they were hiking in a scenic and largely peaceful area of northern Iraq near the porous border.

They were detained in July 2009 along with a third American, Sarah Shourd, who was released in September 2010 on $500,000 bail, on medical and humanitarian grounds, and returned to the United States. Shourd’s case “is still open,” the state-run TV Web site reported.

Bauer and Fattal, both 29, have been sentenced to three years each for illegal entry into Iran and five years each for spying for the United States, the Web site said. It was not immediately clear whether that includes time served. They have 20 days to appeal.

Their Iranian attorney, Masoud Shafiei, said that he has not been notified of the verdict but that he would appeal the sentence if true.

— Associated Press