A Christian who was demoted in his job for posting his opposition to gay marriage on Facebook only expressed his views like anyone might do in a pub with friends, a court heard on Friday.

Adrian Smith lost his managerial position and had his salary cut by 40% by Trafford Housing Trust (THT) after posting that gay weddings in churches were "an equality too far".

He has taken his employers to Manchester County Court claiming they acted unlawfully in demoting him.

He claims THT breached his employment contract and interfered with his right to free speech and his case is being supported by the Christian Institute, a national civil liberties charity.

The dispute began on February 13 last year when Mr Smith saw an article on the BBC News website headlined "Gay church marriages get go ahead".

He linked to the article on his personal Facebook page and added the comment: "An equality too far."

His Facebook page can only be viewed by friends, and friends of friends, but not by the general public. Some of his colleagues are listed as his Facebook friends.

Two colleagues read the remark and one of them posted a response asking Mr Smith to explain what he meant.

The next evening Mr Smith posted: "I don't understand why people who have no faith and don't believe in Christ would want to get hitched in church.

"The Bible is quite specific that marriage is for men and women. If the state wants to offer civil marriage to the same sex then that is up to the state; but the state shouldn't impose its rules on places of faith and conscience."

Bosses at Trafford Housing Trust were then alerted to the comments, and took disciplinary action against Mr Smith.

The trust says he broke their code of conduct by expressing religious or political views which may upset co-workers.

Hugh Tomlinson QC, representing Mr Smith, said employees had a right to private religious and political views outside of their employment.

And he contended Mr Smith was not promoting his views but merely expressing his beliefs.

The trust claimed Mr Smith's Facebook page was in some respects part of a work environment because 45 co-workers were listed as his friends.

But Mr Tomlinson drew a distinction between expressing an opinion on a person's own Facebook page, which others had voluntarily joined, and emailing private opinions to someone.

Mr Tomlinson put it this way to the court: "I'm going to sign up to your Facebook page, receive your postings, provided they don't say things which are contrary to my religious views?

"Well Facebook doesn't have a setting for that."

He said Mr Smith was asked by another to explain his views and he did so in a reasonable manner - likening the exchange to an everyday discussion you would have in a pub with friends.

He added: "If someone expresses a lawful opinion outside of work, the fact that there is a risk some people might be offended by it - such risks always exist.

"Anything can be taken wrongly by some people.

"On political and religious matters there's a real risk whatever you say will offend somebody."

Mr Tomlinson cited the trust's own diversity policy as reason for allowing people to have different views.

"Inevitably, in a diverse workforce people have diverse views," he said.

"And are entitled to express them provided they don't do so (in a way) that is judgmental or confrontational or promotional."

Mr Justice Briggs reserved his judgment, which is expected some time in the next two weeks.

Mr Smith, who is still employed by THT, made no comment outside court.