In one of the most momentous days in recent Spanish history, Spain fired Catalonia's regional government and dissolved its parliament Friday after a defiant Catalan declaration of independence that flouted the country's constitution.
Lawmakers in the Catalan parliament voted to unilaterally declare independence, prompting the swift crackdown by the Spanish government, which also called an early election in the region.
Hours after Catalonia's secession move, the Spanish Senate granted the government special constitutional powers to stop the wealthy region's move toward independence.
Spanish Prime Minister Mariano Rajoy's conservative government then called an urgent Cabinet meeting late Friday, after which Rajoy emerged to announce the emergency measures, including regional elections called for Dec. 21.
In Barcelona, Catalonia's regional capital, Rajoy's announcement in a televised address was greeted with jeers and whistles of disapproval from crowds who had gathered at the gates of the government palace to celebrate their parliament's moves toward independence.
"It's not about suspending or meddling in the self-government (of Catalonia), but to return it to normality and legality as soon as possible," Rajoy said.
The government and Spain's Constitutional Court have both said the secession bid was illegal, and after Friday's independence vote, Rajoy said it was a move that "not only goes against the law but is a criminal act."
Rajoy also said he was firing the head of the Catalan regional police, shutting down the Catalan government's overseas offices, and dismissing its representatives in Madrid and in Brussels, where the European Union has its headquarters.
After the Catalan parliament independence vote, Rajoy said it was a move that "in the opinion of a large majority of people not only goes against the law but is a criminal act."
The Senate's decision giving Rajoy special powers trumped the Catalan regional parliament's vote to secede, which was doomed because the Constitutional Court has already consistently ruled against any steps toward independence.
The battle around Catalonia's future is far from over, however.
Madrid's move to take away Catalonia's regional powers was sure to be seen as a humiliation and a provocation by Catalans and a backlash was expected, with planned street protests and the possibility that regional government workers could follow a policy of disobedience or non-cooperation.
On top of that, the Dec. 21 election could deliver a steadfastly pro-independence Catalan parliament, even if recent polls have suggested the region of 7.5 million people is roughly evenly split on secession.
Many Catalans strongly oppose independence and a group of so-called unionists was organizing a large-scale protest in Barcelona on Sunday.
A spokesman for Spain's prosecutor's office, meanwhile, said it would seek to bring rebellion charges against those responsible for the Catalan independence vote.
The tense day, featuring emotional speeches and scenes of joy and despair, went to the heart of Spain's political and cultural history.
The 1978 constitution, drawn up after the end of Gen. Francisco Franco's decades-long dictatorship, created a decentralized Spanish state that devolved power to 17 autonomous regions, including Catalonia. The regions have broad administrative and legal powers. The Spanish constitution, however, also describes Spain as "indivisible."
Catalonia has its own cultural traditions and its own language. Having long seen itself as different from the rest of Spain, the Catalan drive for independence began in 2010 when the Constitutional Court struck down key parts of a groundbreaking charter that would have granted the region greater autonomy and recognized it as a nation within Spain.
Catalonia represents a fifth of Spain's gross domestic product and many want the tax revenues generated by the prosperous region to remain at home.
The motion to secede was approved by the 135-member Catalan parliament, where secessionists hold a slim majority, with 70 votes in favor. Opposition lawmakers had walked out of the chamber in protest ahead of the vote.
After the vote officials and lawmakers let loose cries of "Freedom!"
In an emotional scene, regional leader Carles Puigdemont called on cheering fellow separatists to remain peaceful.
"In the days ahead we must keep to our values of pacifism and dignity. It's in our, in your hands, to build the republic," Puigdemont said.
Outside parliament, thousands who had gathered cheered the news, some dancing and raising a toast. In Barcelona, people crowded around TV sets to watch the historic events unfold. The famous Sant Jaume Square outside the regional government office was packed with thousands of people celebrating. Many were draped with the "Estelada" flag that adds a blue triangle to the red and yellow Catalan flag and has become a symbol of the separatist struggle.
"I feel so emotional after the huge fight we went through, we finally got it ... the independence of Catalonia!" said 74-year-old Rosalina Cordera Torelles.
Nearby, 24-year-old Rita Carboneras could hardly contain her excitement.
"I'm super, super, super happy. Super excited," she said. "So relieved. Now we are Catalan at last. We can be ourselves. We are just happy, look everyone around. Everything is so exciting."
The exhilaration was short-lived. Some 500 kilometers (300 miles) to the southwest, the Senate in Madrid voted by an overwhelming margin of 214 to 47 in favor of granting the government exceptional powers.
The main opposition Socialist and pro-business Citizens parties support Rajoy's stance on Catalonia, and many Spaniards outside the region are scornful of Catalonia's secession ambitions.
Rajoy has also received support from outside Spain, with other European leaders, including Germany, France and Britain, rejecting Catalonia's claims. The U.S. administration also backed Rajoy, after President Donald Trump last month branded the Catalan independence ballot as "foolish."
"Catalonia is an integral part of Spain, and the United States supports the Spanish government's constitutional measures to keep Spain strong and united," U.S. State Department spokeswoman Heather Nauert said in a statement.
Also supporting Rajoy's warnings of trouble in Catalonia if it forges ahead with its secession bid, more than 1,500 businesses have moved their official headquarters out of Catalonia this month to ensure they can continue operating under European Union laws if Catalonia secedes.
The EU says Catalonia will be tossed out of the bloc if it leaves Spain and would have to apply to become a member, a lengthy process.