A federal judge in San Jose said Tesla must defend itself at trial to answer charges that it threatened to deport foreign workers at its plant in Fremont if they reported an injury at the facility, and that the workers put in too many hours in violation of U.S. labor laws.

Judge Lucy Koh, of the California Northern District Court, made the ruling in the case Lesnik v. Eisenmann SE late Monday. Koh threw out five charges against Tesla, but allowed two to remain that stem from allegations made by former Tesla employee Gregor Lesnik, who came from Slovenia to work at Tesla. Lesnik was hired by a Tesla subcontractor, ISM Vuzem, and sent to work at Tesla’s Fremont facility.

In the suit, Lesnik claims that he was paid less than minimum wage while working for Tesla, and that Tesla threatened to deport foreign employees if they reported work-related injuries, and withhold their wages if they called into work sick.

Koh also declined to remove Eisenmann and ISM Vuzem from the lawsuit, because both did work for Tesla at the company’s plant.

In a statement, Tesla denied the charges, saying that “As far as the law goes, Tesla did everything correctly,” when it hired and used Eisenmann to build a paint shop for the automaker. Eisenmann, in turn, hired ISM Vuzem to work on the project. Tesla said it no longer uses ISM Vuzen.

Related Articles Tesla CEO Elon Musk’s next big bet rides on better batteries

Elon Musk expected to use Tesla ‘Battery Day’ to argue for the end of combustion engines

New documentary examines Elon Musk’s conflict with tiny Texas community

Tesla is on the cusp of a sales record, which could give Elon Musk another huge payday

Tesla driver ‘completely reclined’ and apparently asleep at 90 mph, police say “We hired a contractor to do a turnkey project at our factory and, as we always do in these situations, contractually obligated them to comply with all laws in bringing in the resources they felt were needed to do the job,” Tesla said. “Had there been something else we could have done differently or better in this situation, we would have done it.”

Koh’s decision came just days after Tesla, and Chief Executive Elon Musk, each agreed to pay $20 million in fines to the Securities and Exchange Commission to settle SEC fraud charges against Musk. That deal also allowed Musk to remain as Tesla’s CEO, but step down as company chairman for at least three years.