A young man convicted of sodomy by an Islamic Shariah court in northern Nigeria was whipped 20 times on Thursday.

20-year-old Mubarak Ibrahim, an unemployed artisan, pleaded guilty in the city of Bauchi to one act of sodomy carried out seven years ago.

He said he was tricked into the act by the principal of the high school he was attending and has not since committed a homosexual act.

Download the new Independent Premium app Sharing the full story, not just the headlines

Mr Ibrahim was spared a sentence of death by stoning because the incident occurred many years ago and because he had shown “great remorse,” Judge Nuhu Mohammed said.

The lashes were given using an animal skin whip in the packed public court. Mr Ibrahim was also ordered to pay a fine of 5,000 naira (around £20). It was not clear if he was able to immediately pay the fee and go free.

Though it was under Shariah law that Mr Ibrahim was found guilty, the conviction is the first of a gay man in the country since President Goodluck Jonathan - a Christian - signed a bill that further criminalises homosexuality.

As well as greatly harming human rights, activists say the law also greatly endangers gay people in a country where homophobia is rife and public lynchings are common.

Nigeria’s Muslim Rights Concern group meanwhile claimed that Western powers who have condemned the law are meddling in Nigerian internal affairs.

“Most reprehensible is the attempt by foreign powers to intimidate and coerce Nigeria into absorbing their despicable culture by threatening to withhold foreign aid,” it said, praising Mr Jonathan for resisting external pressures.

Mr Ibrahim was among 12 men — 11 Muslims and one Christian — who have been arrested by police since Christmas for belonging to a gay club.

The new law bans same-sex marriage or civil union, public displays of affection between members of the same sex and the operation or participation in gay clubs.

Dorothy Aken'Ova, a human rights activist said police four of the men arrested had been tortured into providing a list of 168 gay men.

Shariah Commission chairman Mustapha Baba Ilela denied any of those arrested were tortured. He said that police were hunting for other members of a gay club, but would not say how many, The Associated Press reports.