BAKU -- Power has gone out for a second time in much of the Azerbaijani capital, stranding thousands underground in subway cars as the authorities struggled with a nationwide outage sparked by an explosion at a hydroelectric station.

With summer temperatures soaring, the July 3 outage in Baku came hours after the country was initially plunged into darkness, in one of Azerbaijan's worst blackouts in decades.

Much of Baku was hit by the second blackout, which shut down the subway system and stranded some trains between stations, forcing rescuers to evacuate thousands of passengers. Subway managers later said the system would remain shut until at least July 4.

The state-run APA news agency reported early on July 4 that power supplies had been restored to all regions of Baku and the rest of the country.

The initial outage occurred overnight on July 3, affecting nearly the entire country.

By daybreak, power was restored in many areas and at essential facilities like hospitals, military bases, the subway, and the airport, the state-run APA news agency reported.

The authorities said an explosion at a hydroelectric power station in the northern city of Mingacevir was to blame. President Ilham Aliyev's office also blamed extremely hot weather, and the widespread use of air conditioning, for causing an overload of the electrical system.

The outage was the largest in Azerbaijan since at least 2002, and one of the worst since the 1991 Soviet breakup.

A spokesman for state-run Azerenergy said the country was negotiating with Russia for replacement power supplies.

Delays were reported at Baku international airport, and the state railway company also reported some delays.

The State Oil Company of Azerbaijan-- a major employer and the generator of the country's main source of revenue -- said the disruption did not affect offshore oil operations but caused some problems with production on land.

Forecasters said temperatures were expected to soar to as high as 43 degrees Celsius and remain there through July 4, posing further strains on the electrical system.

There were few details about the explosion at the Mingacevir hydropower station. The Emergencies Ministry said no one was hurt or killed in the explosion.

Yahya Babanli, a spokesman for state energy company Azerenergy, told Real TV that the authorities moved to import electricity from Georgia and Russia.

By early on July 3 the electrical supply had resumed in northern and western areas, including Mingacevir city, as a result of energy supplies being imported from Russia, Real TV, APA, and Azerenergy reported.

Babanli said that it could take a while for the power plant to recover from the explosion, which occurred at a substation connected to several high-voltage power lines.

With reporting by APA and Turan