Boris Johnson and evangelical activists, including the leader of the Christian Legal Centre, have both welcomed a Court of Appeal ruling over the 2012 decision to ban anti-gay adverts on London’s buses.

The decision to ban the adverts was taken just days before the London mayoral election in May 2012. Mr Johnson had warned that the content was “clearly offensive”.

The posters, which were due to run on 24 buses, said: “Not Gay. Ex-Gay, Post-Gay and Proud. Get over it!” and were in response to a previous poster campaign by gay rights charity Stonewall, which said: “Some people are gay. Get over it!”

Christian charity Core Issues Trust said that Mr Johnson had abused his position as Mayor of London in having the adverts pulled.

They claim it was done so under the basis of him trying to secure the gay vote.

The High Court had upheld the ban in March 2013.

But on Monday, the Court of Appeal ruled a judicial investigation was needed to consider whether Mr Johnson had acted “for an improper purpose”.

Andrea Minichiello Williams, chief executive of the Christian Legal Centre which has supported Core Issues Trust, said: “The effect of such a ruling means that the past and present campaign being run by Stonewall breaches Transport for London’s Advertising standards and is illegal.

“Stonewall knows this but has brazenly decided to pursue its agenda.

“In a mature democracy both sides of a debate should be heard but it seems that Boris Johnson, Transport for London and Stonewall are intent to shut down the Christian side of the debate by fair means or foul.”

Dr Mike Davidson, who leads Core Issues Trust, said he would write to the mayor to ask for all emails linked to the ban, “current and potentially deleted”, to be made available to his lawyers.

Responding to the ruling, Mr Johnson’s official spokesman said: “The Mayor is pleased TfL’s original decision to ban the Core Issues Trust advert has been upheld by the Court of Appeal. He agreed with TfL’s ban at the time and will continue to support the banning of adverts that breach advertising policy and cause widespread public offence, as this advert clearly did.”

Stonewall said it did not comment on ongoing legal investigations.

In his ruling, the Master of the Rolls Lord Dyson said evidence had been produced of “an email which unequivocally states that the mayor ‘instructed’ TfL to pull the advertisement,” just before London went to the polls.

Lord Dyson said the email sent on 12 April 2012 “shows that the mayor’s office contacted the Guardian (newspaper) immediately, apparently in order to make political capital out of the story”.

Arrangements were also been made for Mr Johnson to appear the following day at a hustings event organised by Stonewall at the Southbank.

The judge said: “This is a most unsatisfactory state of affairs.”

Lord Justice Briggs also noted that even if the High Court eventually rules in favour of overturning the ban, Transport for London can “nonetheless lawfully decide again to refuse to accept the Trust’s advertisement”.