The EPA is accusing Volkswagen of illegally using software to cheat emissions standards, allowing the German automaker to sell half a million cars that produce nitrogen oxide, which creates smog, at up to 40 times the legal limit.

In a notice of violation of the Clean Air Act sent to Volkswagen AG, Audi AG, and Volkswagen Group of America, Inc today, the EPA said diesel-powered VW cars used a "defeat device," a kind of "a sophisticated software algorithm [that] detects when the car is undergoing official emissions testing, and turns full emissions controls on only during the test. The effectiveness of these vehicles’ pollution emissions control devices is greatly reduced during all normal driving situations."

The accusation applies to 482,000 diesel-powered, four-cyclinder Jetta, Beetle, Audi A3, and Golf cars sold between 2008 and 2015 in the US, and to Passat cars sold from 2014 to 2015. The news comes as the Frankfurt motor show, one of the biggest events of the year for the automaker, opens to the press.

The White House has directed VW to recall the affected cars, and the automaker will be required to fix the problem, at no cost to car owners.

The accusation is a serious blow to VW's effort to promote "clean diesel," which is more energy rich than gasoline, and produces better miles per gallon figures. It sells the majority of diesel-powered passenger cars in the country.