The United States is suing Volkswagen for allegedly violating U.S. federal environmental laws by installing illegal software in thousands of its diesel vehicles and cheating on emissions tests.

The U.S. Justice Department, on behalf of the Environmental Protection Agency, on Monday filed a civil complaint against the German automaker, as well as Porsche and Audi, both part of the Volkswagen Group.

The complaint, filed in Detroit, Michigan, alleges that Volkswagen breached the Clean Air Act, a major environmental law aimed at reducing air pollution, by selling nearly 600,000 diesel-engine vehicles in the U.S. that were equipped with devices that deliberately circumvented U.S. regulations on emissions, “resulting in harmful air pollution.”

“Car manufacturers that fail to properly certify their cars and that defeat emission control systems breach the public trust, endanger public health and disadvantage competitors,” said Assistant Attorney General John Cruden, head of the Justice Department’s Environment and Natural Resources Division, in a statement. “The United States will pursue all appropriate remedies against Volkswagen to redress the violations of our nation’s clean air laws alleged in the complaint.”

The Justice Department says the software was able to detect when a given vehicle was being tested for compliance with EPA emissions standards, and would turn on acceptable emissions controls only during that time. On the road, the cars emitted nitrogen dioxide, an air pollutant, up to 40 times the levels allowed.

The fraud came to light last September when the Obama administration said U.S. regulators had found that starting in 2009, the German automaker had installed illegal software in thousands of its “clean diesel” vehicles in order to dodge emissions standards set by the EPA for certain air pollutants, which contribute to smog.

Volkswagen quickly owned up to rigging the tests, and revealed it had installed the software in 11 million cars worldwide. Its CEO, Martin Winterkorn, resigned days after the U.S. announcement. The company’s shares nosedived. Michael Horn, the company’s top U.S. executive, admitted “we have totally screwed up,” and was called to testify before the House Commerce and Energy Committee in October, where lawmakers heavily castigated him and the automaker.

A Justice Department official told Reuters on Monday the lawsuit could cost Volkswagen “billions of dollars.” The automaker has already set aside billions of euros to handle the fallout from the scandal.