A Transport for London spokesman said: "The High Court has found that we were right not to run the Core Issues Trust's advertisement as it would have breached Section 149 of the Equality Act 2010.
"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."
More top news
A drunk man who narrowly escaped death when he lay down between train tracks in Harlow has been given a 12-month community order.
A man from north London has been charged with the manslaughter of Louella Eve Fletcher-Michie, who died at the Bestival music festival.
The mother of Ellie Butler - the six-year-old murdered by her father - has lost a bid to challenge her conviction.