An Egyptian court jailed eight men for three years on Saturday over a video prosecutors claimed was of a gay wedding, which went viral on the Internet.
Homosexuality is not specifically banned under Egyptian law, so the men, arrested in September, were convicted of broadcasting images that "violated public decency."
The court also sentenced the eight to three years of probation once they have served their terms.
The video, filmed aboard a Nile riverboat, shows what prosecutors said was a gay wedding ceremony, with two men in the centre kissing, exchanging rings and cutting a cake with their picture on it.
The video went viral on social media websites such as Facebook, Twitter and YouTube.
Their arrests were the latest in a string of highly publicised police raids on suspected gays in the country, prompting a US-based social networking application used by gays to urge caution to users in Egypt.
Known as Grindr, it warned that Egyptian police, who had said they planned to monitor social networking sites, could be using it to entrap gays.
One of the defendants, prior to their arrest, told a television talk show that the video was recorded during a birthday party.
After the verdict, the defence again denied that the men were gay, as their relatives outside the court room yelled out in protest: "Our sons are being oppressed."
The relatives were kept outside the court room to protect the journalists inside. Several of them had tried to assault journalists in past hearings, saying they did not want further "scandal."
Signup to our newsletter and follow us on Facebook and Twitter!
One defence attorney, Emad Sobhi, insisted that the court had caved in to popular pressure in the conservative country.
"My clients are innocent of practising homosexuality," he told AFP. "The court succumbed to public opinion."
A spokesman for the justice ministry's forensics had told AFP before Saturday's hearing that an invasive anal exam of the men showed that they did not have receptive anal sex.
"The medical test showed that the eight defendants have not practised homosexuality recently or in the past," Hesham Abdel Hamed had said.
Rights groups have denounced the tests often performed in Egypt on men suspected of homosexuality.
The New York-based group Human Rights Watch also criticised the verdict.
The ruling "is the latest signal that the new government will prosecute anyone to try to bolster its support," said a statement quoting Graeme Reid, its Lesbian, Gay, Bisexual, and Transgender (LGBT) rights director.
In the past, Egyptian homosexuals have been jailed on charges ranging from "scorning religion" to "sexual practices contrary to Islam," the country's dominant religion.
In April, a court sentenced four men to up to eight years in prison for practising homosexuality.
Prosecutors had accused them of holding "deviant parties" and dressing in women's clothes. Three were sentenced to eight years and the fourth to three years in prison.