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
Every Christmas gets a bit more desperate for one dog at Battersea. Can you help?
The problem has meant that no trains are able to run through Gatwick Airport rail station in West Sussex.
Schoolchildren found Eragon wearing a Christmas jumper in the bag filled with dog food, treats and a tear-jerking note, in a church.