A firefighter walks near the entrance to NuStar Energy fuel storage facility Wednesday, Oct. 16, 2019 after a Tuesday fire in Crockett, Calif. Officials were trying to determine Wednesday if a 4.5 magnitude earthquake triggered an explosion at a fuel storage facility in the San Francisco Bay Area that started a fire and trapped thousands in their homes for hours because of potentially unhealthy air. (AP Photo/Jeff Chiu)

SAN FRANCISCO (AP) — Officials were trying to determine Wednesday if a 4.5 magnitude earthquake triggered an explosion at a fuel storage facility in the San Francisco Bay Area that started a fire and kept thousands of people in their homes for hours because of potentially unhealthy air.

The earthquake struck about 15 miles (24 kilometers) southeast of the NuStar Energy fuel storage facility in Crockett 15 hours before the fire Tuesday that consumed thousands of gallons of ethanol, a gasoline additive.

Fire and company officials said the cause of the fire at the facility was still being investigated.

"We do not yet know if it is related to the earthquake," said NuStar spokeswoman Mary Rose Brown.

Contra Costa County Fire Protection District spokesman Steve Hill said the earthquake was one of several possibilities investigators were considering but added that it was too early to say what caused the explosion.

"I think we dodged some bullets here in the last 24 hours," Hill said, adding that the tanks were filled at 1% capacity, which still amounted to about 250,000 gallons (946,325 liters) of ethanol.

Video footage of Tuesday's fire about 30 miles (50 kilometers) northeast of downtown San Francisco showed an explosion so strong that it blew the lid from one tank high into the air. The fire badly damaged or destroyed the two tanks, the remnants of which were still covered a day later with fire-fighting foam to prevent any rekindling.

Monday night's 4.5 magnitude earthquake centered in Pleasant Hill was the strongest in the San Francisco Bay Area in several years and was felt across the region.

"We conducted an audio, visual and olfactory inspection after the earthquake," NuStar spokeswoman Brown said in a statement. She said employees walked through the facility looking for damage or compromise in tanks, pipes, fittings and associated equipment. "There was no damage detected after the earthquake."

The facility remained closed Wednesday as inspectors assessed the damage and came up with a plan for repairs, Brown said. Officials did not know when the plant would resume operations.

Brown also said inspectors tested Wednesday for "a multitude of potential contaminants and all were below detectable levels." Monitoring will continue.

Aftershocks in the area were still being felt Wednesday, including one with a 3.4 magnitude.

The Monday earthquake caused malfunctions at two nearby oil refineries operated by Shell and Marathon, Randy Sawyer, Contra Costa County's chief environmental health and hazardous materials officer, told KQED News.

Pipeline safety expert Richard Kuprewicz said the fire could have been caused by any number of factors, and while investigators couldn't rule out the earthquake he considered it unlikely.

"The odds of this being caused by an earthquake would be extremely unusual," said Kuprewicz, adding that pipelines are designed with earthquakes in mind to handle a lot of stress and movement. The fire could have been caused by a pipe that failed, a broken seal on a pump that created a leak or some other problem that allowed ethanol to escape to the atmosphere where it found a source of ignition.

"You don't need a flame to have ignition," he said. "It could just be a static charge, or if it's really dry out there."

The seven-hour blaze shot towering, thick black smoke into the sky above the facility. NuStar says on its website it has 24 tanks capable of holding more than 3 million barrels of ethanol, gasoline, diesel and aviation fuels there.

The black smoke could be seen for miles, prompting officials to order people in the communities of Crockett, Rodeo and part of Hercules to stay inside with fans and air conditioners off. They were told to seal their windows and doors with tape or wet towels amid concerns that hazardous particulates might be spewing from the fire.

County health officials later lifted the shelter in place order affecting about 12,000 people. At least four schools were closed Wednesday as a precaution, even though health officials did not believe there is a public health threat.

"We have been sampling air in the community immediately surrounding the facility checking for particulate matter and other stuff and the air doesn't appear to be unusually high with anything that we would be concerned about," county health department spokesman Karl Fischer said.

Damage from a Tuesday, Oct. 15, 2019, fire is shown at NuStar Energy fuel storage facility in Crockett, Calif., Wednesday, Oct. 16, 2019. Officials were trying to determine Wednesday if a 4.5 magnitude earthquake triggered an explosion at the fuel storage facility in the San Francisco Bay Area that started a fire and trapped thousands in their homes for hours because of potentially unhealthy air. (AP Photo/Jeff Chiu)
A fire broke out at NuStar Energy LP facility in Crockett, Calif., Tuesday, Oct. 15, 2019. The Contra Costa Health Department posted on Twitter that there was a
Mark Storey takes photos of damage from a Tuesday, Oct. 15, 2019, fire at NuStar Energy fuel storage facility in Crockett, Calif., Wednesday, Oct. 16, 2019. Officials were trying to determine Wednesday if a 4.5 magnitude earthquake triggered an explosion at a fuel storage facility in the San Francisco Bay Area that started a fire and trapped thousands in their homes for hours because of potentially unhealthy air. (AP Photo/Jeff Chiu)
ADDS NAME AND LOCATION OF OIL STORAGE FACILITY In this image from video provided by the Napa County Sheriff's Office, tanks are on fire at an oil storage facility Tuesday, Oct. 15, 2019, viewed from Rodeo, Calif. A fire burning at NuStar Energy LP facility in Crockett, Calif, in the San Francisco Bay Area prompted a hazardous materials emergency that led authorities to order the residents of two communities, Crockett and Rodeo, Calif., to shelter in place and stay inside with all windows and doors closed. Contra Costa Fire Department spokesman Steve Hill said that an hour into battling the blaze, firefighters seemed to be making progress and were continuing to keep adjacent tanks cooled with water. (Henry Wofford/Napa County Sheriff's Office via AP)
A burned hillside is shown from a Tuesday fire at NuStar Energy fuel storage facility in Crockett, Calif., Wednesday, Oct. 16, 2019. Officials were trying to determine Wednesday if a 4.5 magnitude earthquake triggered an explosion at the fuel storage facility in the San Francisco Bay Area that started a fire and trapped thousands in their homes for hours because of potentially unhealthy air. (AP Photo/Jeff Chiu)
Interstate 80 is closed as a fire at an oil storage facility burns Tuesday, Oct. 15, 2019, in Crockett, Calif. A fire burning at NuStar Energy LP facility prompted a hazardous materials emergency that led authorities to order the residents of two communities, including Rodeo, to stay inside with all windows and doors closed.
Fire and emergency crews walk past damage from a Tuesday fire at NuStar Energy fuel storage facility in Crockett, Calif., Wednesday, Oct. 16, 2019. Officials were trying to determine Wednesday if a 4.5 magnitude earthquake triggered an explosion at a fuel storage facility in the San Francisco Bay Area that started a fire and trapped thousands in their homes for hours because of potentially unhealthy air. (AP Photo/Jeff Chiu)
Fire and emergency crews walk past damage at NuStar Energy fuel storage facility, Wednesday, Oct. 16, 2019, in Crockett, Calif. Officials are trying to determine if a 4.5 magnitude earthquake the day before triggered an explosion at the facility. (AP Photo/Jeff Chiu)