Editor's note: Read a version of this story in Arabic.
(CNN) -- A Cameroon appeals court upheld a sentence against a man convicted of homosexuality for texting his male friend to say, "I'm very much in love with you."
Roger Mbede, a university student, was arrested in March last year after the man who received the message tipped off authorities, Human Rights Watch said.
A court sentenced Mbede to three years in prison at the time after he was beaten to coerce a confession, according to the group.
In July, after more than a year in detention, Mbede was released as his case went through the appeals process, the rights group said in a statement.
The appeals court issued its ruling Monday.
"The appeals court decision ... is a blow to key human rights principles, including the right to privacy, the right to equality, and the prohibition of torture and ill-treatment," said Neela Ghoshal, a researcher at Human Rights Watch.
"The decision sends a warning to LGBT Cameroonians that they risk beatings, arrests, and imprisonment simply because of their sexual orientation or gender identity."
Homosexuality is illegal in most African countries, where sodomy laws were introduced during colonialism.
Cameroon's sentences for homosexual acts vary between six months to five years, the rights group said, citing justice ministry records.
Authorities in the west African nation were not immediately available for comment.
A series of countries have criminalized homosexuality, but prosecutions are rare.
In Uganda, homosexual acts are punishable by 14 years to life, but lawmakers are trying to introduce a bill that toughens the law.
A handful of nations issue a death penalty for consensual same-sex relations, including Sudan, Mauritania, Saudi Arabia and Iran, according to the International Lesbian, Gay, Bisexual, Trans and Intersex Association.