(WFLA) — It took thousands of gallons of water to extinguish a fire in a Sacramento wrecking yard, according to fire officials.

The Sacramento Metropolitan Fire District said a Tesla was involved in an accident three weeks prior the blaze and sustained “major damage.” Sometime later, it was transported to the wrecking yard for dismantling.

Crews said the fire took them, “a significant amount of time, water, and thinking outside the box to extinguish.”

Firefighters first tried to knock the fire down, but the car’s batteries kept re-igniting. Next, crews worked with on-site wrecking yard personnel to turn the Tesla on its side in order to gain access to the battery compartment underneath.

“Even with direct penetration, the vehicle would still re-ignite due to the residual heat,” the department said.

Crews ultimately dug a small pit, placed the car inside, and filled it with water, effectively submerging the battery compartment.

Authorities said the pit ultimately reduced the total amount of water needed. Crews estimated they used 4,500 gallons of water to put out the flames.

There were no reported injuries.