A waiter wearing a face mask to prevent the spread of coronavirus sweeps the terrace of a bar in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sanchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

Spain's government declared a state of emergency in Madrid on Friday, wresting control of efforts to fight the spread of COVID-19 from local authorities in a region that is experiencing one of Europe's most significant coronavirus outbreaks.

The step, which took immediate effect and lasts for two weeks, forced Madrid authorities to restore restrictions on travel that had been introduced by the national government but were struck down the previous day by a Madrid court ruling.

That successful legal challenge by Madrid officials was part of a long quarrel between the country's main political parties over their coronavirus response. Those differences, and the changing rules, have often dismayed and confused local residents.

"Well, it is all very nauseating," Vicente de la Torre, a 22-year-old Madrid mechanic, told The Associated Press. "We have no idea what we should do or what we shouldn't do."

The government announced the state of emergency after a hastily arranged Cabinet meeting in the wake of the court ruling. Health Minister Salvador Illa said the previous measures would come back into force and that only the legal framework for them was changing.

He told a press conference it was "undeniable" that there is community transmission in the Madrid region, not just isolated outbreaks, at a crucial juncture as winter approaches and respiratory problems increase.

Waiters wearing face masks to prevent the spread of coronavirus wait for customers at the Plaza Mayor square in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

"Action is needed, and today we couldn't just stand by and do nothing," Illa said. "It's very important that this doesn't spread to the rest of the country."

The Madrid region's 14-day infection rate of 563 coronavirus cases per 100,000 residents is more than twice Spain's national average of 256 and five times the European average rate of 113 for the week ending Sept. 27.

The central government's measures prohibit all nonessential trips in and out of the capital and nine of its suburbs, affecting some 4.8 million people. Restaurants must close at 11 p.m. and stores at 10 p.m.. Both must limit occupancy to 50% of their capacity.

The national government had ordered police in Madrid to fine people if they left their municipalities without justification. More than 7,000 police officers will now be deployed to ensure the restrictions are observed, Interior Minister Fernando Grande-Marlaska said.

  • People wearing face masks to prevent the spread of coronavirus sit in a terrace bar in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A customer sits inside of a bar in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A cleaner wearing a face mask to prevent the spread of coronavirus works at the Plaza Mayor square in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A waiter wearing a face mask to prevent the spread of coronavirus waits for customers in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A man looks though a window inside of a coffee bar in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A waiter wearing a face mask to prevent the spread of coronavirus waits for customers in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A worker wearing a face mask to prevent the spread of coronavirus cuts a piece of ham in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sánchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • A woman wearing a face mask to prevent the spread of coronavirus walks in front of a restaurant displaying a banner To Rent, in downtown Madrid, Spain, Friday, Oct. 9, 2020. Spanish Prime Minister Pedro Sanchez is holding a Cabinet meeting to consider declaring a state of emergency for Madrid in order to impose stronger anti-virus restrictions on reluctant regional authorities. (AP Photo/Manu Fernandez)

  • Spanish Prime Minister Pedro Sanchez, delivers his speech as he attends a meeting with Spanish and Algerian business representatives, Thursday, Oct.8, 2020 in Algiers. (AP Photo/Anis Belghoul)

  • A Madrid Emergency Service (SUMMA) health worker checks the temperature of a man prior to a rapid antigen test for COVID-19 in the southern neighbourhood of Vallecas in Madrid, Spain, Wednesday, Oct. 7, 2020. About 5.2 million people in Spain, including nearly 4.8 million residents in or around Madrid, are under restrictions on movement due to the second wave of the coronavirus pandemic. (AP Photo/Manu Fernandez)

But Madrid's conservative regional government opposed those restrictions, saying they were draconian and hurt the economy. Madrid's regional president, Isabel Díaz Ayuso, said her own, more moderate measures were enough to fight COVID-19.

A Madrid court on Thursday upheld the regional government's appeal, saying the national government's imposition of restrictions violated people's fundamental liberties.

The spat has taken place against a backdrop of political differences: Spain's national government is led by the center-left Socialist party, while the Madrid region is run by the country's main opposition party, the conservative Popular Party.

"It seems to me like an ideological war that is trying to show who has more power," said 18-year-old student Marta Illo. "They (the Spanish government) don't really like the regional government of Madrid. And we the people of Madrid are paying the price for a fight that is really political and has nothing to do with us."