An Egyptian court on Saturday convicted eight men for "inciting debauchery" following their appearance in an alleged same-sex wedding party on a Nile boat, sentencing each of them to three years in prison.
The Internet video shows two men exchanging rings and embracing among cheering friends. The eight were detained in September when a statement from the office of Egypt's chief prosecutor said the video clip was "shameful to God" and "offensive to public morals."
The verdict was received with protesting screams by relatives waiting outside the Cairo courthouse court. Some of them broke down and cried while others protested that medical examinations carried out by state doctors showed the defendants were not gay.
While inside the defendants' cage for the hearing, the eight were pictured burying their heads in their hands or hid their faces under baseball caps. They covered their faces with pieces of cloth or paper when they were led by police out of the cage after they heard the verdict.
Egypt is a conservative majority Muslim country with a sizeable minority of Christians.
Homosexuality is a social taboo for both communities and only in recent years fiction and movies have included gay characters.
Consensual same-sex relations are not explicitly prohibited, but other laws have been used to imprison gay men in recent years, including "debauchery" or "shameless public acts." Same-sex marriage is unheard of in Egypt.
The verdict is the latest in a crackdown by authorities against homosexuals and atheists. The campaign also targets liberal and pro-democracy activists and violators of a draconian law on street protests.
New York-based Human Rights Watch said in September that Egyptian authorities have repeatedly arrested and tortured men suspected of consensual gay conduct.
In April, four men were convicted and sentenced to eight years in prison for "debauchery" after allegedly holding parties that involved homosexual acts and where women's clothing and makeup were found.
In 2001, Egypt made headlines around the world when 52 men were arrested in a police raid on a Nile boat restaurant and accused of taking part in a gay sex party. After a highly publicised trial in an emergency state security court, 23 of the men were convicted and sentenced to prison terms of one to five years for immoral behaviour and contempt of religion.
Egypt's crackdown on homosexuals and atheists is taking place as the country of nearly 90 million people appears to be steadily moving to the right, with jingoism and xenophobia dominating the media as the army and security forces battle Islamic militants waging a campaign of violence against them in the Sinai Peninsula. The media, meanwhile, is targeting civil society groups and activists, accusing them of being foreign agents on the payroll of sinister foreign organisations.
Authorities say the country's national interests must take precedence over everything else so Egypt can be spared the fate of countries like Syria, ravaged by a three-year-old civil war, or neighbouring Libya, where radical Islamic militias control large swathes of the oil-rich nation.
A much harsher crackdown targets members of the Muslim Brotherhood, the now-banned Islamist group that has been labelled a terrorist organisation by the state. Authorities have killed hundreds of Islamists and jailed thousands since the military last year toppled the regime of Mohammed Morsi, who hails from the Brotherhood.
Morsi's ouster took place in July 2013 as millions of Egyptians staged street protests to demand his removal.