SAN FRANCISCO (AP) — A gas explosion in a San Francisco neighborhood shot flames into the air for hours Wednesday and burned five buildings, sending panicked residents and workers fleeing into the streets.

It took utility crews more than two hours to put out the fire after private construction workers cut a natural gas line, igniting the towering flames, Fire Chief Joanne Hayes-White said. Authorities initially said five workers were missing, but the entire construction crew was found safe, and no other injuries were reported.

Officials evacuated several nearby buildings, including a medical clinic and apartment buildings, Hayes-White said. Vehicles on a busy street got rerouted as authorities cordoned off the bustling retail and residential neighborhood.

The fire damaged a building housing Hong Kong Lounge II, a popular dim sum restaurant frequented by tourists and students at the University of San Francisco that made many “best of” lists.

Caroline Gasparini, 24, who lives catty-corner from where the fire ignited, said she and her housemate were in their living room when the windows started rattling. She looked up to see flames reflected in the glass.

Gasparini said they saw employees of the burning restaurant run out the back door and people fleeing down the block.

Nick Jalali, 28, was cooking at home when the electricity cut out.

“We didn’t hear anything,” he said. “We just felt the shaking, and the next thing we knew, people were banging on the door to tell people it’s time to start evacuating.”

Firefighters worked to keep the fire from spreading while Pacific Gas & Electric crews tried to shut off the natural gas line.

PG&E spokeswoman Melissa Subbotin said state excavation rules required crews to dig by hand around other pipelines before they were eventually able to “squeeze” a 4-inch (10-centimeter) plastic line.

She said that because the fire was contained to a limited area, the utility had to weigh the threat from the fire with the risk of more drastic action.

“Had we turned the gas off to a transmission system, we would have shut off gas to nearly the entire city of San Francisco,” she said. “The objective of this was to turn the gas off safely and as quickly as possible.”

In an earthquake, Subbotin said PG&E would shut off a transmission line. The company stressed that the workers who cut the gas line are not affiliated with the nation’s largest utility.

The fire began around 1:20 p.m., apparently by crews working on fiber-optic wires, Hayes-White said.

Joseph Feusi lives four blocks away and said he was awoken by what sounded like a jet engine. Feusi, who works nights and sleeps in the afternoon, said he could see the towering flames from his home.

“I think the eight guys are really lucky they didn’t get blown to bits,” he said.

PG&E is under heightened scrutiny over its natural gas pipelines after one exploded under a neighborhood south of San Francisco in 2010, killing eight people and wiping out a neighborhood in suburban San Bruno.

A U.S. judge PG&E $3 million for a conviction on six felony charges of failing to properly maintain the pipeline, and the utility remains under a federal judge’s watch in that case.