DETROIT — Detroit officials fully restored electricity to downtown government buildings, schools, a hospital, traffic lights, and police and fire halls on Tuesday after a major cable failure caused parts of the city to go without power for up to seven hours.

All customers of the municipal power system affected by the failure had their service back, the city announced at 5:15 p.m. The power failure happened around 10:30 a.m.

Mayor Mike Duggan said the power grid had not been modernized in decades in Detroit, which is emerging from the largest municipal bankruptcy in United States history. DTE Energy Company is taking over the system and spending hundreds of millions of dollars upgrading it.

The electrical grid has been plagued by aging transmission lines, which have failed under the stress of high demand. Power to downtown has been lost several times in recent years.