A Cameroon judge has overturned the conviction of two men who were found guilty of homosexuality and sentenced for five years in prison for “looking gay” and ordering Bailey’s Irish coffee.

The two men were convicted in November 2011 and had already spent a year in prison where they were subjected to abuse from the prison guards and other prisoners, according to human rights advocates. The court of appeals on Monday acquitted the two men and ordered their release, the National Post reports.

President Paul Biya was urged by human rights lawyers and gay rights advocates to release all other prisoners found guilty under the country’s harsh anti-gay laws.

On December 17, the same appeal court upheld the three-year jail term of 32-year-old Jean-Claude Roger Mbede, found guilty of homosexual conduct because he sent a text message to another man saying: "I'm very much in love with you."

Homosexuality is illegal in many African countries. In Cameroon, the penalties range from six months to five years in jail. In 2011, there were 12 convictions.

Read more: Guinness and Baileys Irish cupcakes