BARCELONA, Spain (AP) — Spain announced an unprecedented plan Saturday to sack Catalonia’s separatist leaders, install its own people in their place and call a new local election, using previously untapped constitutional powers to take control of the prosperous region that is threatening to secede.

Catalonia’s president responded by making a veiled independence threat, telling lawmakers to come up with a plan to counter Spain’s “attempt to wipe out self-government.”

Even moderate Catalans were aghast at the scope of the move, greeting Prime Minister Mariano Rajoy’s announcement with banging pots and honking cars in the streets of Barcelona, the regional capital.

In a televised address late Saturday, Catalan President Carles Puigdemont called Rajoy’s plans to replace him and his cabinet an “attempt to humiliate” Catalonia and an “attack on democracy.” He called on the regional parliament to “debate and decide on the attempt to wipe out our self-government and our democracy, and act accordingly.”

Puigdemont called Rajoy’s move the “the worst attack” on Catalan people and institutions since Gen. Francisco Franco’s abolishment of Catalonia’s regional government in 1939.

Barcelona mayor Ada Colau, who opposes independence without a valid referendum, called Rajoy’s measures “a serious attack” on self-government in Catalonia. Others went further. Catalan parliament speaker Carme Forcadell accused Spain’s central authorities of carrying out a coup.

“Mariano Rajoy has announced a de facto coup d’etat with the goal of ousting a democratically elected government,” Forcadell said, calling it “an authoritarian blow within a member of the European Union.”

After a special Cabinet session to derail Catalonia’s independence movement, Rajoy said he wants the country’s Senate to allow central ministers to take over the jobs of all senior members of the Catalan government, including control over the regional police, finances and the public media.

Rajoy is also seeking the Senate’s approval to assume the power to call a regional election — something that only Catalonia’s top leader can do now.

The vice president of the Senate says a session next Friday will vote on the measures. Conservative senator Pedro Sanz told reporters a special commission of 27 senators will make a first assessment of the measures Tuesday. He said Puigdemont can appeal the moves by appearing before the commission before noon Thursday or by sending an envoy.

Rajoy’s ruling Popular Party has an absolute majority in the chamber and is expected to receive wide support from opposition senators for measures to protect Spanish unity.

In response, protesters wrapped in red-and-yellow Catalan flags flooded the streets of central Barcelona on Saturday, holding up signs calling for freedom.

About 450,000 people joined the protest, according to police, although an anti-secession group put the number at 85,000. The demonstration had originally been called to protest the detention of two pro-independence activists who are awaiting possible sedition charges, but it turned into an outcry over Rajoy’s takeover move.

“We are here because the Spanish government made a coup without weapons against the Catalan people and their government institutions,” said Joan Portet, a 58-year-old protester.

Rajoy said he is using Article 155 of the Spanish Constitution in order to “restore normalcy” in the country, which faces its most grave institutional crisis in decades with Catalonia’s independence movement. He said a new regional election in Catalonia should be held in the next six months.

“There is no country in the world ready to allow this kind of situation within its borders,” Rajoy said. “It is my wish to call an election as soon as normality is restored.”

Article 155 allows central authorities to intervene when one of Spain’s 17 autonomous regions fails to comply with the law. It’s never been applied since the 1978 Constitution was adopted.

The slow-burning constitutional crisis over secession escalated this month when regional government officials held a disputed independence referendum on Oct. 1. They then declared that the result — strongly in favor of independence — gave them a legal basis for separating from Spain even though the vote itself had numerous problems.

The country’s Constitutional Court has so far ruled against all moves toward secession, including the Catalan referendum.

Albert Rivera, head of the pro-business Citizens party, said he backed Rajoy’s measures because Catalonia needs to restore legal security so companies can remain in the region. Hundreds of companies have transferred their registered headquarters out of Catalonia to other areas in Spain, fearing the chaos that independence — or the fight over it — could bring.

Basque nationalists and the far-left Podemos party were among those in Madrid opposing the government’s move.

“We are in shock about the suspension of democracy in Catalonia,” said Podemo’s Pablo Echenique, vowing to work to oust Rajoy and his conservative Popular Party.

Barcelona resident Rosa Isart said the Spanish government’s determination to prevent Catalonia from leaving reminded her of Franco’s dictatorship decades ago.

“It seems unbelievable that I have to see this again, because of the incompetence of these politicians who don’t know how to speak to each other,” Isart said.

Others were sympathetic to Rajoy’s plan. Barcelona resident Carlos Assensio agreed with Madrid, given the separatists’ refusal to abide by Spain’s laws.

“If we don’t respect the law, this could be a total anarchy,” said the 65-year-old.