The High Court has ruled that Transport for London's decision to refuse a Christian group's bus advertisement was not unlawful.
The advertisement had been booked by the Core Issues Trust, which works with people who have unwanted same-sex attractions. It was to run with the slogan: "Not Gay! Ex-Gay, Post-Gay and Proud. Get over it!"
The advert was a response to one placed on buses by gay lobby group Stonewall reading, "Some people are gay. Get over it!"
The Core Issues Trust advert was withdrawn in April last year following an intervention by London Mayor Boris Johnson, who is chairman of Transport for London.
TfL justified the decision at the time on the basis that it was "likely to cause widespread or serious offence to members of the public" and that it included "images or messages which relate to matters of public controversy and sensitivity".
The Core Issues Trust claimed that Mr Johnson's intervention was politically motivated because of the timing, just weeks away from the mayoral election on 3 May.
Mrs Justice Lang ruled that Mr Johnson did not abuse his position by imposing the ban.
However she said that the advert placed by Stonewall was "highly offensive" and that the TfL had fallen "below the standards to be expected of a responsible public body".
She criticised the process to remove the advert, saying it had been "unfair" and that TfL had been "in breach of its own procedures".
Andrea Minichiello Williams, head of the Christian Legal Centre, which supported the Core Issues Trust, said the judgement was an "important victory for Christian freedoms and a stinging rebuke for Boris Johnson and TfL".
"Blatant discrimination will not be tolerated by the courts," she said.
"This case demonstrates the huge asymmetry and censorship that characterises public debate at the moment."