A Federal High Court in Lagos on Tuesday dismissed a case against an internet sensation James Brown and 46 other men charged with public display of affection with members of same sex.
Justice Rilwan Aikawa said he was dismissing the case because of the “lack of diligent prosecution”.
The trial was widely seen as a test case for a law introduced in 2014 that bans same-sex “amorous relationships”.
Former President Goodluck Jonathan signed the law banning gay marriage. The law carries a jail term of up to 14 years.
But the specific charge the men faced, relating to public display of affection, carries a 10-year prison sentence.
Brown and the others were arrested in a police raid on a Lagos hotel in Egbeda in 2018 and paraded at the Police Command in Ikeja.
Police claimed the men were being initiated into a gay club, but the defendants said they were attending a birthday party.
Prosecutors failed to attend a hearing at the court, having previously failed to present witnesses in a case that had been adjourned on several occasions.
It was gathered from prosecution and defense lawyers in the case that nobody had yet been convicted under the law.
Some of the men arrested told the news media they had been stigmatised because of the incident.
Brown had said at the time of the parade that he only attended the party as a dancer.
The 22-year-old said the police arrested him despite repeatedly telling them of his health status. He says he is HIV positive.
Homosexuality is outlawed in many socially conservative African societies.
However, Brown took to Instagram on Tuesday to celebrate the court victory.
“I’m free like a bird. HOMOSEXUALITY CASE CLOSED. Congratulations to 57 runway boys we won (we no be gay),” he wrote.