BARCELONA - Hundreds of thousands of protesters flooded Barcelona’s streets Saturday as Spain took drastic measures to stop Catalonia from breaking away, announcing plans to dismiss the region’s separatist government and call fresh elections.

Catalan leader Carles Puigdemont and his regional executive — who sparked Spain’s worst political crisis in decades by holding a banned independence referendum — will be stripped of their jobs and their ministries taken over under measures laid out by Prime Minister Mariano Rajoy.

Barcelona police said 450,000 people had joined a protest in the regional capital, many of them chanting the words “freedom” and “independence” and waving Catalonia’s yellow, red and blue separatist flag.

“I feel totally outraged and extremely sad,” said Meritxell Agut, a 22-year-old bank worker.

“They’ve trampled on our rights and our ideas as Catalans,” she told AFP, adding: “They can destroy everything they want but we’ll keep on fighting.”

Madrid could take direct control over Catalonia’s police force and replace its public media chiefs, with Rajoy saying he had no other choice, faced with a grave threat to Spain’s national unity.

Elections for the semi-autonomous region must be called within six months, he added.

The measures must now pass through the Senate — a process that will take about a week — but Rajoy’s conservative Popular Party (PP) holds a majority there and his efforts to prevent a break-up of Spain have the backing of other major parties.

Autonomy is a highly sensitive issue in Catalonia, which saw its powers taken away under the dictatorship of General Francisco Franco.

Home to 7.5 million people, the wealthy northeastern region fiercely defends its language and culture and has previously enjoyed control over its policing, education and healthcare.

Puigdemont, leading the crowds spilling out from Barcelona’s Paseo de Gracia boulevard in a protest originally called to urge the release of two detained separatist leaders, was due to give his response at 9:00 pm (2100 GMT). Though she opposes the independence drive, Barcelona mayor Ada Colau also deplored Madrid’s decision, tweeting: “Rajoy has suspended the self-government of Catalonia for which so many people fought. A serious attack on the rights and freedoms of everyone.” Under Article 155 of Spain’s constitution, Madrid has the power to wrest back control of rebellious regions, but it has never used it before.

Rajoy said the measure was a last resort as Puigdemont refuses to drop his threat to declare independence based on the results of the October 1 referendum, which had been ruled unconstitutional.

“This was neither our desire nor our intention,” Rajoy said. “We are applying Article 155 because the government of a democratic country cannot accept that the law is ignored.” Oriol Bartomeus, politics professor at the Autonomous University of Barcelona, said the central government was taking a huge risk. “The game could end badly, very badly for Rajoy’s government,” he told AFP. “It’s going to be like a colonial administration, and independence supporters will see it as an occupation.”

Allowing 54 days for campaigning, new elections would fall in mid-June at the latest.

Separatists of all political stripes, from Puigdemont’s conservatives to the far-left, have dominated the Catalan parliament since the last elections in 2015, holding 72 seats out of 135.

Prosecutors said Saturday they would take mop-haired former journalist Puigdemont to court for “rebellion” if he makes any attempt to declare independence, a crime punishable with up to 30 years in jail.

The president of FC Barcelona, one of the world’s best-known symbols of Catalan identity, threw his weight behind the region’s institutions.

“We must reiterate our absolute support for the democratic institutions of Catalonia chosen by its people,” Josep Maria Bartomeu said, urging a “civil and peaceful” reaction to Rajoy’s decision.

Puigdemont says 90 percent backed independence in the referendum, but turnout was 43 percent as many Catalans who back unity stayed away while others were hindered from voting by a police crackdown.

Catalonia is roughly evenly split over whether to break away from Spain , according to polls, with supporters saying the region pays too much into national coffers but their opponents arguing it is stronger as part of a bigger country.

The crisis has worried the European Union as it struggles with Brexit and taken a toll on one of Spain’s most important regional economies, with nearly 1,200 companies shifting their legal headquarters elsewhere in a bid to minimise the instability.