Thousands of protesters have gathered outside a Barcelona court as the former head of the eastern Spanish region of Catalonia, Artur Mas, went on trial for staging an informal independence referendum.

Shouting "Independence, independence", "Down with Spain's justice system" and "We want to vote," some 40,000 people on Monday turned up at the court, many of whom held separatist red and yellow flags.

Catalonia is home to a strong separatist movement and pro-independence campaigners held a vote in 2014 on whether to break away from Spain while Mas was regional governor.

The poll was carried out without legal backing because the central Spanish government blocked it in the courts, saying it was against the constitution. The symbolic ballot was manned by volunteers to get around the restrictions.

More than 80.8 percent of those who cast their ballot in the 2014 vote did so for independence - although only 2.3 million people out of a total of 6.3 million eligible voters took part.

Mas, who stepped down as leader last year, stands accused of disobedience against the state and wrong-doing as a public official. He could face a 10-year ban from public office if found guilty.

But Mas' defence lawyers argue that by agreeing to an unofficial vote in 2014, the Catalan administration was merely defending "the right to freedom of expression" of Catalans, many of whom want a say in the future of their 7.5 million-strong region.

"Independence isn't on trial here, democracy is on trial," Mas told journalists in the court.



"It's the first time that a democratic government is tried for having allowed people to vote. It's an unprecedented moment."

"Today, many of us feel as if we're being tried," current regional head Carles Puigdemont added outside the court.

'Proof of Spain's rule of law'

But Alfonso Dastis, Spain's foreign minister, retorted that the trial was merely a proof of the "rule of law" in Spain.



"What is on trial is an act that failed to acknowledge a Constitutional Court sentence, nothing more," he said from Brussels, where he is attending a meeting

OPINION: Catalonia's declaration of independence

The trial comes at a time of high tension between Prime Minister Mariano Rajoy's minority government in the capital, Madrid, and Catalonia's local separatist administration.

Catalonia's current government has promised to hold an independence referendum in September - a binding one this time, with or without Madrid's consent.

But how exactly it will go ahead is unclear, as Rajoy's conservative government insists that this type of local, one-region-only referendum is unconstitutional, and has vowed never to allow an act that would risk the unity of Spain.

Last week, reports emerged in several national dailies that Madrid was considering drastic measures to stop a vote, such as closing schools where polling booths could be set up or taking control of the police, which is normally managed by regional authorities.



The government neither confirmed nor denied the reports.



Rajoy has given his deputy prime minister, Soraya Saenz de Santamaria, the task of starting regular talks with Catalan authorities, but so far these have not yielded any results.



The Catalans themselves remain divided over the issue - 44.9 percent want independence while 45.1 percent are against it, according to a recent poll conducted by a Catalan public institute.



A large majority, however, wants a referendum.