On Friday, the US Environmental Protection Agency (EPA) accused Volkswagen Group of purposely installing software on some of its cars to cheat on emissions tests. According to the New York Times, Volkswagen Group will have to recall 500,000 Volkswagens and Audis on which so-called “defeat devices” were installed.

In a Notice of Violation (PDF) sent to the automaker, the EPA said that the defeat devices on Volkswagen Group's cars “render inoperative elements of the vehicle's emission control system.” If the car senses that it's operating normally, the defeat device reduces the effectiveness of some or all of the car's emission control components. However, if the car is undergoing an emission test, the emission control systems will be allowed to function normally.

According to the EPA's letter, the software on Volkswagens and Audis was installed on the cars' electronic control module and determined whether the car was driving normally or undergoing testing “based on various inputs including the position of the steering wheel, vehicle speed, the duration of the engine's operation, and barometric pressure.” If the car was driving under normal conditions, the car's nitrogen oxide (NOx) emissions were increased by 10 to 40 times above the level of NOx emissions permitted by the EPA.

NOx contributes to climate change and the destruction of ozone. Excessive NOx in the atmosphere can cause respiratory health problems.

In a statement to Ars, a Volkswagen Group spokesperson said that the company has received the letter and is cooperating with the EPA's investigation.

The New York Times notes that California regulators have sent a separate notice of violation to Volkswagen Group.

The EPA's letter to the company says that it learned of the violation thanks to a 2014 study published by West Virginia University's Center for Alternative Fuels, Engines, and Emissions. The University found that two Volkswagen diesel vehicles—a 2012 Jetta and a 2013 Passat—gave off significantly higher in-use emissions. Volkswagen denied that there was anything wrong with its models' emissions control systems and asserted that there were technical issues with the individual test cars that contributed to the University's results. Still, the California Air Resources Board (CARB) and the EPA launched investigations.

VW issued a voluntary recall of affected models at the end of 2014, but CARB and the EPA were not able to find noticeably different results in recalled cars. “It became clear that CARB and the EPA would not approve certificates of conformity for VW's 2016 model year diesel vehicles until VW could adequately explain the anomalous issues and ensure the agencies that the 2016 model year vehicles would not have similar issues,” the EPA wrote. “Only then did VW admit it had designed and installed a defeat device in these vehicles in the form of a sophisticated software algorithm that detected when a vehicle was undergoing emissions testing.”

The cars that must be recalled include diesel Jettas after 2009, diesel Golfs after 2010, diesel Audi A3s after 2010, diesel Beetle Convertibles after 2012, and diesel Passats after 2012.