Sheffield University acted lawfully when a devout Christian was thrown off a course over derogatory comments he posted online about homsexuals and bisexuals, a court has ruled.
Felix Ngole, of Barnsley, who was thrown off a social work postgraduate course, appealed against the decision, said it was unfair and claimed he had simply been expressing a traditional Christian view.
But Deputy High Court judge Rowena Collins Rice has ruled that university bosses acted within the law following a High Court trial in London.
Mr Ngole had argued that his rights to freedom of speech and thought had been breached.
But lawyers representing the university argued that he showed ''no insight' and said the decision to remove him from the course was fair and proportionate.
They said Mr Ngole had been studying for a professional qualification, adding that university bosses had to consider his fitness to practise in the field of social work if he held such opinions.
Judge Collins Rice said freedom of religious discourse was a public good of great importance.
But she said social workers had considerable power over the lives of vulnerable people and said trust was a precious professional commodity.
Mr Ngole posted comments two years ago, when in his late 30s, the judge had been told.
He was taking part in an debate on a Facebook page about Kim Davis, a state official in the US state of Kentucky, who refused to register same-sex marriages.
Mr Ngole said he had argued that Mrs Davis's position was based on the 'Biblical view of same-sex marriage as a sin'.
He said he was making a 'genuine contribution' to an important public debate and said he was 'entitled to express his religious views'.
University bosses said he had posted comments on a publicly accessible Facebook page which were 'derogatory of gay men and bisexuals'.
"Public religious speech has to be looked at in a regulated context from the perspective of a public readership," said Judge Collins Rice.
"Social workers have considerable power over the lives of vulnerable service users and trust is a precious professional commodity."
The judge added: "Universities also have a wide range of interests in and responsibilities for their students - academic social and pastoral.
"Where, as Sheffield does, they aspire to be welcoming environments for students from a diverse range of backgrounds, they must expect to be inclusive and supportive of that diversity."
She went on: "Where courses leading to professional registration are concerned, universities have an additional set of responsibilities to their students.
"They must teach and support them to be ready to take up demanding roles in the delivery of public services."