TEHRAN, Iran – 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, a sharp blow to hopes their release was imminent.

The announcement seemed 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 also was likely to raise speculation about Iran using the Americans as political bargaining chips and could 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.

Authorities did not immediately confirm the report and made no further comment. But it was carried on Iran’s highly controlled state media, which is frequently used to make high-profile announcements.

In Washington, State Department spokeswoman Victoria Nuland restated U.S. appeals for the release of the two men. “It is time to reunite them with their families,” she said.

A spokeswoman for the men’s relatives said only that the families were aware of the report and awaiting confirmation.

“They are asking for privacy during this difficult time,” Samantha Topping said.

The Americans, whose final court hearing was three weeks ago, deny the charges and say they were only 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 and returned to the United States. Shourd’s case “is still open,” the state-run TV website irinn.ir 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 website quoted “informed sources” at Iran’s judiciary as saying. It was not immediately clear if that includes time served. They have 20 days to appeal the sentence.

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

“This is a strong verdict inconsistent with the charges,” Shafiei told The Associated Press.

It’s unclear what maximum sentence was possible by the Revolutionary Court, which handles state security issues. Espionage can bring the death penalty, but handing the sentence to a foreigner is unknown legal territory in Iran.

Iran insists that its judiciary is independent from political currents, but Iranian officials have used the detained Americans to draw attention to alleged mistreatment of Iranians in U.S. prisons and others who were held by U.S. forces in Iraq.

The report on the sentences came just two days after President Obama made his most direct call for the resignation of Syrian President Bashar Assad, who remains among Iran’s closest Mideast allies.

The case, meanwhile, has added to tensions between the United States and Iran that were already high over other issues, including Tehran’s disputed nuclear program.

But Iran also recognizes the potential for goodwill gestures. Shourd’s release — assisted by talks by Oman — came last year as Ahmadinejad was preparing for the annual U.N. gathering of world leaders.

The Americans say they mistakenly crossed into Iran when they stepped off a dirt road while hiking near a waterfall in the Kurdish region of Iraq. While other parts of Iraq remain troubled by violence, the semiautonomous Kurdish north has drawn tourists in recent years, including foreigners.

Earlier this month, Foreign Minister Ali Akbar Salehi said he hoped “the trial of the two American defendants who were detained for the crime of illegally entering Iran will finally lead to their freedom.”