City officials announced Sunday that the fire at the Philadelphia Energy Solutions (PES) refinery has been extinguished and that an array of local and federal agencies will be investigating the cause of the blast that injured five workers.

The fire, which erupted in a massive fireball and shook nearby homes, began about 4 a.m. Friday and burned until Saturday afternoon. In a statement, the mayor’s office said the gas valve fueling the fire had been shut off.

Investigators from federal and local agencies, including the Bureau of Alcohol, Tobacco, Firearms and Explosives, are scheduled to begin their investigation early Monday, the statement said. The U.S. Chemical Safety and Hazard Investigation Board (CSB) dispatched a four-member team to the refinery Friday. The city health department and fire hazmat unit will continue to monitor the air quality around the South Philadelphia facility, the largest oil refinery on the East Coast, officials said. As of Friday, air quality tests for 61 different compounds found none at or near harmful levels.

PES reported Sunday that air-quality readings inside the refinery and in the surrounding community continued to be normal.

PES spokeswoman Cherice Corley said Saturday that there had been three separate explosions and that it appeared the main fuel that had persisted in burning was propane. She could not state what exact chemical had also burned.

The fire hit one of the refinery’s alkylation unit, where crude oil is converted into fuels, using hydrofluoric acid as a catalyst. The acid, which can drift for miles as a gas, is one of the most toxic substances in the refinery. Although OSHA in 2009 cited the previous owner, Sunoco, for an escape of hydrofluoric acid, city officials have said none escaped in last week’s fire.

The injuries to refinery workers were minor, officials said.

Hydrofluoric acid can cause serious irritation to skin, eyes, and respiratory tracts even in low concentrations, according to the Centers for Disease Control and Prevention, and can be fatal with enough exposure. About 22 pounds of the substance escaped in 2009 at the South Philadelphia refinery and 13 contract workers had to be hospitalized.

The refinery produces a range of such petroleum products as gasoline, diesel, and heating oil, converting crude oil though processes that are inherently dangerous. Philadelphia’s complex processes 335,000 barrels of crude oil a day, and employs about 1,000 people. The importance of the plant’s products to the region is such that the fire, by reducing production there, caused a 3.7 percent uptick in wholesale gasoline prices on the New York market.

The plant, though, has struggled in a competitive market, and is trying to recover from a bankruptcy filing last year.

Many noted that Philadelphia dodged what could have been a far worse scenario, and others called for the plant’s closure to avoid disaster. Another fire, less serious than Friday’s, happened at the plant on June 10. City Council member Helen Gym joined the group Philly Thrive on Friday to call for the 1,300-acre site’s conversion into public land.

Market forces, though, could kill the facility anyway. The plant’s financial woes could lead to a shutdown in the next few years, stated a University of Pennsylvania report issued in September.

PES urged area residents to call its hotline at ‪215-339-7300 with any concerns.