A Nigerian man has received 20 lashes after an Islamic court in the northern city of Bauchi convicted him of homosexual offences.
Under Islamic law, courts can punish homosexual acts by stoning to death.
But the judge said he took into account that the Muslim man, Mubarak Ibrahim, 20, carried out the acts seven years ago, and had stopped the practice.
Homosexual acts are now illegal under both Islamic and secular law and restrictions have been tightened.
Earlier this month, President Goodluck Jonathan approved a parliamentary bill which bans same-sex marriages, gay groups and shows of same-sex public affection.
The new legislation applies throughout Nigeria.
Most states in the predominantly Muslim north of Nigeria have adopted Islamic law, known as Sharia, since the end of military rule in 1999.
Along with Mr Ibrahim, 11 other Muslims and a Christian man were arrested last month accused by the authorities of being homosexuals.
He was also ordered to pay a fine of about $30 (£18).
Mr Ibrahim told the BBC he was relieved that Judge Nuhu Muhammad had been lenient on him and had not sentenced him to death.
The BBC’s Ishaq Khalid was in court when Mr Ibrahim was lashed with a whip, made of animal skin and smeared with oil.
Mr Ibrahim, who had pleaded guilty to the charge, was ordered to lie on a bench, and an official whipped his back in front of a packed courtroom, our correspondent says.
The trial of two other men was adjourned to 23 January.
The fate of the nine other men arrested on the same charge is unclear but on Wednesday the Sharia Commission in Bauchi said the Christian would be tried by a “conventional court”, not an Islamic court.
Nigeria is a deeply conservative country, with an influential Christian evangelical movement in the south and strong support for Islamic law among many Muslims in the north.
Hostility towards gay people has escalated since parliament debated the Same-Sex Marriage Prohibition Act last year, Dorothy Aken’Ova, a rights activist with the Nigeria-based International Centre for Reproductive Health and Sexual Rights, told the BBC.
She said that she was aware of 38 people being arrested in Bauchi state last month, and was trying to confirm reports of more arrests in both the north and south of Nigeria since the new law was approved.
“What this act is saying is that they [gay people] do not deserve to exist,” she told the BBC’s Focus on Africa programme on Wednesday.