Shane Bauer and Josh Fattal, both 29, and a third UC Berkeley graduate, Sarah Shourd, were arrested on July 31, 2009, after embarking on a hike in Iraq's Kurdistan region near the Iranian border.
Iran has accused them of espionage, but the hikers and their families say they are not spies but instead were detained after they accidentally crossed an unmarked border into Iran.
Iran released Shourd, 32, who is engaged to Bauer, last September because she was in poor health.
Iranian authorities held a four-hour hearing for Bauer and Fattal on July 31 during which the two men again testified as to their innocence, and their attorney had an opportunity to present their defense, according to a statement issued by the men's families.
At that time, the families said the attorney for Bauer and Fattal, Masoud Shafii, told them that Bauer and Fattal "both appeared to be well and in good spirits."
Supporters of the detained hikers have expressed their disappointment and anger over the decision on Facebook and Twitter this morning.
Many of the responders said that they had not given up hope that the two men will be released despite the sentence.
"Never give up hope," one supporter posted on the Free the Hikers Facebook page. "Working together we will get Shane & Josh home and it's not going to be in 8 years. Lace up the boots and let's get back to work."