Walmart has sued Tesla, claiming it installed faulty solar panels that caught fire at seven Walmart locations — causing millions in damage.

The retail giant cut a deal with the company to install solar panels at 244 locations from 2010 to 2016 and now Walmart is suing for breach of contract claiming the panels aren’t safe and Tesla can’t fix them, according to a new Manhattan Supreme Court lawsuit.

Three fires broke out in the spring of 2018. The first at a Beavercreek, Ohio, location on March 7 that year cost the store $784,293 in repairs, lost merchandise and lawyers and consultant fees, the suit says.

The second erupted on May 21, 2018, in Denton, Maryland. The third occurred eight days later in Indio, California, costing the company a combined $8 million in repairs, merchandise and other costs, the court papers claim.

“Why were multiple Walmart stores located all over the country suddenly catching fire? The answer was obvious and startling: the stores all had Tesla solar panels installed by Tesla on their roofs. At each location, the fire had originated in the Tesla solar panels,” the court papers charge.

Then Walmart looked back and discovered that earlier store fires were also allegedly caused by Tesla solar panels, the court documents claim.

The earliest fire was in 2012 at a Long Beach, California, store, another in Milpitas, California, in 2016 and a third in Lakeside, Colorado, in 2017.

Tesla de-energized all of the Walmart solar panels in June 2018, but another fire broke out on a roof at the Yuba City, California, location on Nov. 29 because of the panels, the court documents claim.

The lawsuit says that Tesla’s inspectors “lacked basic solar training and knowledge.”

And the installation of the panels — carried out by SolarCity, which Tesla CEO Elon Musk bought in 2016 — was “rushed” and negligent, the suit alleges.

And despite claims to have “enhanced its inspection protocols” in January, “Tesla has also demonstrated an inability or unwillingness to remediate the dangerous conditions documented in its inspection reports,” the court papers allege.

“Tesla is incapable of maintaining solar systems.”

Walmart says that if they put the panels back into operation it “would create an immediate and imminent risk of injury and harm to Walmart, its customers, its employees, and its property,” according to the court papers.

Walmart says it doesn’t believe that Tesla will be able to fix all the problems, including cracks on the panels and improper wiring, and it wants to end all of their contracts.

Tesla did not immediately respond to an email.

Earlier in August, it was revealed that Musk got a slap on the wrist from the National Highway Traffic Safety Administration for falsely bragging on the company blog that they had the safest cars.