Prosecutors in the northern Nigeria state of Kaduna have charged a group of 53 people with conspiring to celebrate a gay wedding.
The accused, arrested last Saturday, have denied the allegations, with their lawyers saying they were illegally detained.
The court released the group on bail and the case was remanded to 8 May.
Homosexual acts are banned in socially conservative Nigeria and are punishable by up to 14 years in jail.
Africa Live: More on this and other stories
Where is it illegal to be gay?
During a court appearance in Chediya-Zaria, the group pleaded not guilty to charges of conspiracy, unlawful assembly and belonging to an unlawful society.
Defence lawyer Yunusa Umar said most of the accused were students and had been illegally detained for more than 24 hours, the local Premium Times newspaper reported.
Gay rights campaigners who have been in touch with those involved in the case told the Eyes On Events's Stephanie Hegarty in Lagos that the group was attending a birthday party, not a wedding.
Media playback is unsupported on your device