Less than two years after a monument was raised in Madrid to the 35,000 volunteers who joined the International Brigades to fight the fascist-backed forces of General Francisco Franco during the Spanish civil war, a court has ordered that it be pulled down.

The monument to the volunteers from 53 countries, paid for by public subscription and placed in the gardens of the Complutense University, where many died defending Madrid and Spanish democracy against Franco's rebels, has enraged some rightwingers.

A case brought by the lawyer Miguel García has now succeeded where political protest failed. Judges have decided the university broke planning laws and must remove the monument.

Topped by the brigades' three-pointed star, the monument bears the words of Dolores Ibárruri, the communist firebrand better known as La Pasionaria: "You are history; you are legend; you are an heroic example of solidarity and of the universality of democracy."

David Lomon, then the last surviving British-based veteran, travelled to Madrid for the inauguration in October 2011 and asked those present to remember the up to 10,000 volunteers who died.

"The International Brigade was born to fight against Franco, Mussolini and Hitler," he said, recalling the tens of thousands of Italian troops and notorious German bomber squadrons who helped Franco.

"Even though we lost the so-called civil war, the democratic world realised that fascism must be stopped or they too would suffer the same fate. The second world war was a continuation of the war in Spain," he said.

Lomon, a Londoner who was captured and had to keep his Jewish identity secret from Gestapo officials at the jail, died in December aged 94.

The monument, placed a short distance away from a huge victory arch built during Franco's 36-year dictatorship, was soon daubed with graffiti calling the volunteers "murderers".

Supporters of the brigades have written to the British ambassador in Madrid, Giles Paxman, to ask him to intervene.

"Although the court's decision was taken on technical grounds, the original complaint was lodged by a lawyer with known far-right connections," said Jim Jump, secretary of the London-based International Brigade Memorial Trust.

"There is nothing to celebrate, and especially not in a public space devoted to education," García wrote in his original writ. "The international brigades were created and managed by Stalin, the most genocidal leader in history."