MADRID/BARCELONA (Reuters) - Spanish police raided Catalan government offices and arrested officials on Wednesday to halt a banned referendum on independence, an action the regional president said meant Madrid had effectively taken over his administration.

A protestor holds up an Estelada (Catalan independence flag) in front of a line of Spanish national police who surrounded the leftist Popular Unity Candidacy (CUP) party headquarters in Barcelona, Spain, September 20, 2017. REUTERS/Albert Gea

Tens of thousands of protesters gathered outside the regional government offices in the center of Barcelona’s tourist district as well as in several Catalan cities, waving the red-and-yellow Catalan flag and chanting “Occupying forces out” and “Where is Europe?”.

“The Spanish state has by all rights intervened in Catalonia’s government and has established emergency rule,” Catalan President Carles Puigdemont said in a televised address.

“We condemn and reject the anti-democratic and totalitarian actions of the Spanish state,” he said, adding Catalans should turn out in force to vote in the Oct. 1 referendum on a split from Spain that Madrid has declared illegal.

State police arrested Catalonia’s junior economy minister Josep Maria Jove on Wednesday in their first raid of government offices in the region, Catalan government sources said. The raid targeted several regional government departments.

A dozen high-ranking local officials were arrested, La Vanguardia newspaper said. Police confirmed they were carrying out raids connected with the banned referendum, but did not give details. The Catalan government sources could not confirm the other arrests.

In several Barcelona districts, people banged on balconies railings and dumpsters while passing cars hooted noisily.

Among the protesters outside the government office in Barcelona, was Carlos, a 47-year-old taxi driver.

“We’re here so they know they can’t do whatever they want,” he said, as protesters bore banners reading “Democracy” and “Vote to be free”.

Slideshow ( 30 images )

The FC Barcelona soccer club said in a statement: “FC Barcelona, in remaining faithful to its historic commitment to the defense of the nation, to democracy, to freedom of speech, and to self-determination, condemns any act that may impede the free exercise of these rights.”

Police efforts to stop the referendum have intensified in recent days as the wealthy northeastern region shows no signs of halting it.

Acting under court orders, police have raided printers, newspaper offices and private delivery companies in a search for campaign literature, instruction manuals for manning voting stations and ballot boxes.

The Civil Guard, a national police force, on Wednesday seized 10 million ballot papers, polling station displays as well as documents and forms to run the vote, including a list of voters under the headline “2017 Catalonia self-determination referendum”.

(For a graphic on Catalonia secession click tmsnrt.rs/2xw6JtO)

STOCK MARKET FALLS

It had on Tuesday seized more than 45,000 envelopes packed in cardboard boxes that the Catalan government was ready to send to notify people about the referendum, while the first of hundreds of Catalan mayors appeared before the state prosecutor after they said they would back the referendum.

Spain’s finance ministry has taken over the region’s finances to prevent the use of public money to organize the vote.

But the central government must tread a fine line in enforcing the law in the region without seeming heavy-handed. Polls show a minority of Catalans, albeit more than 40 percent, support independence although a majority want a referendum on the issue.

Prime Minister Mariano Rajoy said on Wednesday the operations in Catalonia were the result of legal rulings and were to ensure the rule of law.

He later called on Catalan leaders to cancel the vote.

“Don’t go ahead, you don’t have any legitimacy to do it. Go back to the law and democracy (...) This referendum is a chimera,” he said in a televised speech. Any action that broke the law would be met with a proportionate response, he added.

The Constitutional Court has suspended the vote after the central government challenged its legality. Spain’s central government says the referendum goes against the 1978 constitution which states Spain is indivisible.

Under Article 155 of the constitution, Madrid has the power to suspend the regional government’s authority to rule. It has yet to exercise this option as it seeks to block the vote through the courts.

Although markets have so far shrugged off the increasing tension, Spain’s top stock index underperformed regional European stock peers on Wednesday.

The IBEX fell more than 1 percent by late afternoon trading with financials the biggest drags. Euro zone stocks were off about 0.2 percent.