CAIRO — An Egyptian court convicted eight men on Saturday of charges of “inciting debauchery” after their appearance in a video of a same-sex wedding party on a Nile riverboat, sentencing each to three years in prison.

The Internet video shows two men exchanging rings and embracing among cheering friends. The eight men 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.”

Egypt is a conservative majority Muslim country with a sizable minority of Christians. Homosexuality is a social taboo among Egyptians of both faiths and only in recent years have fiction and movies 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.