Northern California firefighters used 4,500 gallons of water to put out a fire in a Tesla Model S that spontaneously burst into flames and kept reigniting in a junkyard earlier this month, the Sacramento Fire District said.

The electric car had sustained major damage in a crash three weeks before and was scheduled to be dismantled when it caught fire. 

Tesla fire

Firefighters made a pit for the Tesla and filled it with water to extinguish the flames. (Sacramento Metropolitan Fire Department)

"The vehicle was fully involved with fire on arrival, and took a significant amount of time, water, and thinking outside the box to extinguish," the department said, noting it was Metro Fire’s first Tesla blaze. 

"Crews knocked the fire down, but the car kept re-igniting and off-gassing in the battery compartment. Working with the on-site wrecking yard personnel, the Tesla was moved on its side to gain access to the battery compartment underneath."

TESLA IN PENNSYLVANIA CATCHES FIRE, FLAMES SPREAD TO HOME 

The department said, even with direct penetration with water, the car kept reigniting because of residual heat. Responders eventually had to make a small pit, place the car inside and fill it with about 4,500 gallons of water. 

SIX-FIGURE TESLA MODEL S PLAID BURST INTO FLAMES WITH DRIVER INSIDE, ATTORNEY SAYS 

Tesla fire

The Sacramento Metropolitan Fire Department said the Tesla Model S kept re-igniting.  (Sacramento Metropolitan Fire Department)

"The pit ultimately reduced the total amount of water needed," the department said "and limited the runoff of contaminated water." 

TESLA RECALLS OVER 285,000 VEHICLES IN CHINA, MOST OF THEM LOCALLY MADE

No injuries were reported. 

Teslas and other electric vehicles have been known to have issues with fires. It can be difficult to put flames out because the vehicles' lithium-ion batteries keep burning until all the energy is released. It can take as long as 24 hours to put out, according to a guide for first responders for the Tesla Model S. 

Tesla fire

A Tesla burst into flames while sitting in a California junkyard earlier this month.  (Sacramento Metropolitan Fire Department)

CLICK HERE TO GET THE FOX NEWS APP

CEO Elon Musk admitted last year there were "more challenges than expected" in developing the Model S and X's new battery pack. "It took quite a bit of development to ensure that the battery of the new S and X is safe," he said at the time, according to CNBC. 

Tesla didn't immediately respond to Fox News' overnight request for comment.