A UK appeals court has ruled in favor of a Christian man who was removed from a university course in 2016 for posting online that homosexuality is sinful.

Felix Ngole had been taking a postgraduate course in social work at the University of Sheffield in South Yorkshire, England.

During a Facebook debate about Kim Davis, a county clerk in Kentucky who refused to issue marriage licenses to same-sex couples, Ngole posted that "the Bible and God identify homosexuality as a sin" and that "same-sex marriage is a sin whether we like it or not. It is God's words and man's sentiments would not change His words," the Guardian reported.

An anonymous complaint was filed with the university, and officials held a "fitness to practice" hearing, determining that the comments Ngole had made could negatively affect gay people he may encounter as a social worker, according to the BBC.

After being removed from the class, Ngole challenged the decision, arguing that he had been expressing a traditional Christian belief and that his rights of free speech and thought under the European Convention on Human Rights had been violated by the university.

Deputy high court judge Rowena Collins Rice ruled against Ngole in 2017, agreeing that the university had acted within its rights in removing him from the class.

The appeals court, however, disagreed. In a July 3 ruling, a three-judge panel overturned the previous court decision, saying the university hearing was "flawed and unfair," the BBC reported.

Lord Justice Irwin, Lord Justice Haddon-Cave and Sir Jack Beatson instructed the university to hold a new hearing to consider Ngole's case.

The University of Sheffield is considering its response to the ruling. The BBC cited a spokesperson for the university, who said that while it supports students' right to a range of beliefs, "we have a responsibility to look at how any concerns raised could impact a student's fitness to practise once registered."

Ngole said the ruling is "great news, not only for me and my family, but for everyone who cares about freedom of speech, especially for those working in or studying for caring professions."

"As Christians we are called to serve others and to care for everyone, yet publicly and privately we must also be free to express our beliefs and what the Bible says without fear of losing our livelihoods," he said, according to The Guardian.