Authorities from Panama to Costa Rica to El Salvador scrambled to restore electricity.(Representational)

A huge power outage plunged millions of people across Central America into darkness Saturday, as authorities from Panama to Costa Rica to El Salvador scrambled to restore electrical service.The blackout affected some five million people in Costa Rica alone, where officials largely had managed to restore service after a nationwide power outage lasting about five hours.Authorities pinned blame for the power outages on a downed Panamanian transmission line that adversely affected the power supply for much of the region.Countries in the region, from Guatemala to Panama, are connected by the same power grid, covering an expanse of some 1,800 kilometers (1,100 miles).But that interconnectedness means that the countries of Central America are vulnerable when there are power grid malfunctions in any one.Chaos reigned in the Costa Rican capital after traffic lights ceased to function, while the main airport in San Jose had to run on backup power until the power system was up and running again.The blackout was the first experienced in Costa Rica, among the most developed countries in Latin America, since 2001.Officials said as many as two million people were left in the dark in Panama, with an undetermined number affected in Nicaragua and El Salvador.Details were not immediately available about how many people were affected by the blackout elsewhere in Central America, or whether they had managed to get their power systems back up and running.Officials at the Costa Rican Institute for Electricity said power was disrupted throughout the entire country, but was restored in most places by 6:00 pm (0000 GMT)."ICE is trying to diagnose the problem," Communications Minister Mauricio Herrera, said earlier Saturday referring to the office by its Spanish acronym. He said that workers succeeded in restoring power to some areas of Costa Rica.ICE said that the origins of the blackout were outside of the country and urged the public to remain indoors while they try to fix the problem.In Panama, the ETESA government power authority said via Twitter that the nation had experienced just a "partial blackout" and that workers were trying to restore power to the affected areas.Much of the power was restored about three hours after the blackout started, officials said.The blackout in Panama occurred about 15 minutes into a major speech delivered by President Juan Carlos Varela to the country's legislature.

Nicaragua for a time had to tap the grid in neighboring Honduras to keep the lights on.