Transport for London's decision to ban a Christian group's controversial bus advert about gays was not unlawful, the High Court has ruled.
The ad posters, earmarked for the sides of the capital's buses, suggested that gay people can be helped to "move out of homosexuality". The advert read: "Not Gay! Ex-Gay, Post-Gay and Proud. Get over it!"
Core Issues Trust, the Christian charity behind the ads, had taken the matter to court, claiming that London Mayor Boris Johnson - who is chairman of TfL, was "politically driven" when he intervened to block the ad in the run up to the last mayoral elections.
Mr Johnson condemned the "gay cure" ad as "offensive to gays" and said it could lead to retaliation against the wider Christian community.
But a judge ruled that the Mayor of London did not abuse his position.
Mrs Justice Lang, sitting at London's High Court, said that TfL's process in introducing the ban "was procedurally unfair, in breach of its own procedures and demonstrated a failure to consider the relevant issues".
But that was outweighed by factors against allowing the ad, including that it would "cause grave offence" to those who were gay and was perceived as homophobic, "thus increasing the risk of prejudice and homophobic attacks", said the judge.
TfL insisted that it was an internal decision to ban the advert, of which Mr Johnson was "informed".
Welcoming the court ruling, a spokeswoman for the transport body said: "The advertisement clearly breached our advertising policy as it contained a controversial message and was likely to cause widespread offence to the public.
"This was borne out by the hugely negative public reaction the advertisement generated, including on social media and newspaper websites. We are taking steps to address the Judge's comments regarding our internal processes."
The judge revealed her concern over the issues raised by the case by giving Core Issues permission to appeal to the Court of Appeal.
The judge said that, although she did not think an appeal would succeed, there were "compelling reasons" to allow an appeal to go ahead.
She said the case "concerns interference with the right to freedom of expression which is a matter of such fundamental importance that it merits consideration by the appellant court."
Core Issues, which works with gay people seeking to change their lifestyles, had asked the judge to rule that the charity was unlawfully denied the freedom to express its views on homosexuality.
Paul Diamond, appearing for the charity, said it was imposed in April last year "very close" to the mayoral election on May 3, when Mr Johnson defeated political opponent Ken Livingstone.
Mr Diamond said: "It was clearly a highly-charged issue, and the mayor took credit for the highly, politically-driven decision.
"The mayor was strongly of the view this advertisement should not run."
Mr Diamond said the Core Issues Trust had nothing but "utter respect for people struggling with same-sex attraction".
He denied that it was attempting to offer a so-called "gay cure".
He said the ads were a response to a bus poster campaign by gay rights group Stonewall, which carried the message: "Some people are gay. Get over it!"
Mr Diamond contended the trust was equally entitled to express its view on the sides of buses, and to have its right to freedom of expression protected under Article 10 of the European Convention on Human Rights.