Spain's Interior Ministry has declared a state of emergency after a nationwide power blackout hit most of the Iberian Peninsula.
The ministry on Monday added that the emergency status will be applied in the regions that request it.
So far, Madrid, Andalusia and Extremadura have asked for the central government to take over public order and other functions.
The move came hours after a massive blackout hit Spain, Portugal, and part of southern France on Monday, grid operators said, leaving millions of people impacted.
The cause for the outage was not immediately reported.
Spain's railway operator Adif said that the power cut halted trains across the entire country, while airports operator Aena said "several incidents" occurred in Spanish airports.
Mobile phone networks went down. AFP reporters in Madrid and Barcelona saw many inhabitants coming out into the streets, holding their smartphones up to try to connect to a network.
Many people had to use the radio instead of the inaccessible internet to get news on the situation.
Many traffic lights had ceased to function, forcing vehicles to slow to avoid collisions, while metros and trains were halted. Spain's national road authority DGT urged motorists to stop using the roads.
Spanish Prime Minister Pedro Sanchez was on his way to the headquarters of the state electricity network operator Red Electrica to be briefed on the emergency, his office said.
Portugal's REN operator said in a statement to AFP that the entire Iberian peninsula was affected by the blackout, as well as part of France, adding that the outage occurred at 11:33 am (1033 GMT).
Spain's Red Electrica said it had managed to start restoring power in the north and south of the country but the problem was not yet resolved.
"We are continuing to work to bring back power," it said.
Spain's El Pais newspaper posted photos on its website of stopped metro trains in Madrid, police directing traffic, and its own reporters working in a darkened office by the torchlight.
Meanwhile, it was later reported that power was restored in southwestern France.
"An electrical incident is currently affecting Spain and Portugal, the cause of which remains to be determined," RTE said.
"In France, homes were without power for several minutes in the Basque Country. All power has since been restored."