Relatives of two American men arrested more than two years ago in Iran said Sunday that the news they had received eight-year prison sentences for spying hit them hard, but they remain hopeful the men will eventually be released.

Shane Bauer and Josh Fattal were sentenced Saturday to three years for illegal entry into Iran and five years for spying for the United States. The two were arrested in July 2009 near the Iraq-Iran border along with a third American, Sarah Shourd, who was released in September on $500,000 bail and returned to the U.S. All three deny the charges, saying they were only hiking near the ill-defined border.

Samantha Topping, spokeswoman for Bauer and Fattal's families, sent a statement Sunday, saying their relatives had received confirmation of their sentences.

"Of the 751 days of Shane and Josh's imprisonment, yesterday and today have been the most difficult for our families," it said. "Shane and Josh are innocent and have never posed any threat to the Islamic Republic of Iran, its government or its people."

But the statement also said the families still hoped the two would be released, based on remarks from Iran's Foreign Minister Ali Akbar Salehi. He said earlier this month that 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."

The families had been hoping that meant the men would be set free during the Islamic holy month of Ramadan, when pardons are traditionally handed down. Their Sunday statement appealed "to the authorities in Iran to show compassion and allow them to return home to our families without delay.

"We also ask everyone around the world who trusts in the benevolence of the Iranian people and their leaders to join us in praying that Shane and Josh will now be released," it said.

The gap between words by Salehi and the verdict indicates increasing rift between President Mahmoud Ahmadinejad's administration and hardline judiciary, controlled by Supreme Leader Ayatollah Ali Khamenei who has final say on all state matters.

The Americans' Iranian lawyer, Masoud Shafiei, told The Associated Press on Sunday that his clients were innocent and he would appeal the verdict and sentences.

"I will use entire legal capacity to defend them," he said.

Under Iranian law, a conviction on espionage can carry up to a 10-year prison sentence, while a sentence for illegal entry can run from six months to three years in jail. The terms are often significantly reduced upon appeal.

Shafiei said Bauer and Fattal were notified about the court ruling in prison on Saturday by Iranian authorities.

Iranian state TV first reported the verdict Saturday.

On Sunday, Tehran's chief prosecutor Jafari Dowlatabadi confirmed the sentences and said the Americans have 20 days to appeal. He also said that Shourd's case "is still open and will be tried in absentia."

Secretary of State Hillary Rodham Clinton said the U.S. is "deeply disappointed" by the sentences and the men have the nation's and President Barack Obama's "unflagging support."

"We continue to call and work for their immediate release -- it is time for them to return home and be reunited with their families," she said.

Ahmad Bakhshayesh, a professor of politics in Tehran Azad University, believes the men's sentences are a message to the U.S. that "Iran is trying to relay a tit-for-tat message to Washington that we sentence Americans as you did it against Iranian nationals in the U.S."

Over the past months, Iran has brought up the cases of several Iranians being held in U.S. custody particularly a young woman named Shahrazad Mir Gholikhan.

The mother of twin girls was sentenced in Fort Lauderdale, Florida, in 2009 to serve more than five years in federal prison for her role in a scheme to smuggle 3,500 pairs of military night-vision goggles to Iran in violation of the U.S. embargo.

Iran also has demanded an investigation into the alleged mistreatment of its own citizens in U.S. custody.

The case has added further tension to relations between the U.S. and Iran that are already strained over Tehran's disputed nuclear program. The U.S. government has appealed for the two men to be released, insisting that they have done nothing wrong.

The two countries have no direct diplomatic relations, so Washington has been relying on an interests section at the Swiss Embassy in Tehran to follow the case.