Egypt has arrested seven men for taking part in a gay wedding video that went viral on social media, accusing them of inciting debauchery and undermining public morals.

The seven were arrested on Saturday after appearing in the video purporting to show the country's first gay marriage as two men exchanged rings surrounded by friends.

"Nine of the 16 participants were identified in an investigation and seven were arrested," state news agency MENA said, without specifying whether the two men at the centre of the ceremony were among those detained.

The seven were remanded in custody for up to four days, accused of "incitement to debauchery" and "publishing indecent images," MENA added.

The public prosecutor's office said in a statement that the party took place in April but the footage went viral in August, causing the police to take action to identify the men.

Prosecutors said they had also ordered "medical tests" of the men, a longstanding practice in Egypt to allegedly identify homosexuals that has been denounced by human rights groups.

Homosexuality is not included in a list of sexual offences explicitly outlawed by Egyptian law, but it can be punished under several different statutes on morality.

In April, four men were convicted and sentenced to eight years in prison for debauchery after holding parties that involved homosexual acts where women's clothing and makeup were found.

The largest crackdown on homosexuals in Egypt took place in 2001, when police raided a floating disco called the Queen Boat. Fifty-two men were tried in the case that drew widespread criticism from human rights groups and Western governments.

Source: Agencies