The Environmental Protection Agency accused the German automaker of using software to detect when the car is undergoing its periodic state emissions testing. Only during such tests are the cars’ full emissions control systems turned on. During normal driving situations, the controls are turned off, allowing the cars to spew as much as 40 times as much pollution as allowed under the Clean Air Act, the E.P.A. said.

“We expected better from Volkswagen,” said Cynthia Giles, the E.P.A.’s assistant administrator for the Office of Enforcement and Compliance. She called the automaker’s actions “a threat to public health.”

Agency officials issued the car company a notice of violation and said it had admitted to the use of a so-called defeat device. The recall involves 4-cylinder Volkswagen and Audi vehicles from model years 2009-15.

A spokeswoman for Volkswagen confirmed that the company had received the notice and said the automaker was cooperating with the investigation. She declined to comment further on the case.

The software was designed to conceal the cars’ emission of the pollutant nitrogen oxide, which contributes to the creation of ozone and smog. The pollutants are linked to a range of health problems, including asthma attacks, other respiratory diseases and premature death.

Experts in automotive technology said that disengaging the pollution controls on a diesel-fueled car can yield better performance, including increased torque and acceleration.

“When the pollution controls are functioning on these vehicles, there’s a trade-off between performance and emissions,” said Drew Kodjak, executive director of the International Council on Clean Transportation, a research group. “This is cutting corners.”

It was Mr. Kodjak’s group, in conducting research on diesel vehicles, that first noticed the discrepancy between Volkswagen’s emissions in testing laboratories and on the road. They brought the issue to the attention of the E.P.A., which conducted further tests on the cars, and ultimately discovered the use of the defeat device software.

California has issued a separate notice of violation to the company. California, the E.P.A. and the Justice Department are working together on an investigation of the allegations.

Over the next year, E.P.A. officials said, owners of the affected vehicles should expect to receive recall notices from the company, including information about how to get their cars repaired at no cost to them.

The recall covers roughly 482,000 diesel passenger cars sold in the United States since 2009.

Friday’s notice of violation was the Obama administration’s “opening salvo” in the Volkswagen case, said Thomas Reynolds, an E.P.A. spokesman. The Justice Department’s investigation could ultimately result in fines or penalties for the company. Under the terms of the Clean Air Act, the Justice Department could impose fines of as much as $37,500 for each recalled vehicle, for a possible total penalty of as much as $18 billion.

The notice of violation is part of a broader, more aggressive enforcement effort by federal regulators on the auto industry. Analysts and activists said it was intended to send a message to automakers that they would be harshly treated for compromising federal rules.

“This is several steps beyond the violations that we’ve seen from other auto companies,” said Tyson Slocum, director of the energy program at Public Citizen, a consumer advocacy group. “They appear to have designed a system with the intention to mislead consumers and the government. If that’s proven true, it’s remarkable and outrageous. It would merit a heck of a lot more than just a recall and a fine. We would see criminal prosecution.”

In recent years, the federal government has aggressively pursued automakers for failing to disclose safety violations, although the settlements often reached have fallen short of expectations. On Thursday, General Motors agreed to pay the federal government a $900 million penalty for failing to disclose defects in ignition switches, a deal that disappointed many of the victims’ families. In 2013, Toyota recalled more than 10 million vehicles and agreed to pay the United States government a $1.2 billion settlement, admitting that it concealed information from consumers and regulators about problems with that caused the cars to unexpectedly accelerate.

Analysts said that the administration now appears to be pursuing similar tactics against automakers that conceal violations of health and environmental rules. In November 2014, the administration announced the largest penalty ever for a violation of the Clean Air Act after the Korean automakers Hyundai and Kia agreed to pay a combined $300 million as part of a settlement for overstating vehicle fuel-economy standards on 1.2 million cars.

“They want to make it clear that they’re going to crack down on cheaters,” said Frank O’Donnell, president of the environmental advocacy group Clean Air Watch. “They’re cheating not only car buyers but the breathing public. They want to lay down the law, enforce the law and show they’re not going to tolerate cheaters. The laws and regulation are only as good as the enforcement.”

The notice of violation is especially embarrassing for Volkswagen because it comes days after the company trumpeted plans to introduce 20 plug-in hybrid or all-electric vehicles by 2020 as part of a campaign to reduce vehicle emissions.

News of the recall request also arrives in the midst of the Frankfurt Motor Show, one of the biggest events on the auto industry calendar. Volkswagen has taken over an entire exhibition hall to show off its cars, while Audi has a separate pavilion.

Volkswagen, which also owns the high-end sports car makers Porsche and Lamborghini, recently surpassed Toyota as the world’s biggest automaker. But VW has been struggling to gain market share in the United States, where it has long been weak. The investigation is unlikely to help. In the eight months through August, sales of Volkswagen brand cars in the United States fell 3 percent, to 238,000 vehicles. By comparison, Toyota sold 1.15 million vehicles in the same period.

Richard Corey, an executive officer on the California Air Resources Board, credited “dogged detective work in the lab” for the discovery of the software, which he said resulted in the admission from Volkswagen that the company was using the devices.

E.P.A. officials declined to reveal why they chose to initiate the investigation.

The Volkswagen case is not the first federal investigation into the use of defeat devices. In 2007, the federal government reached a landmark settlement requiring Casper’s Electronics, of Mundelein, Ill., to stop selling the devices, and to pay a $74,000 civil penalty. The company had sold approximately 44,000 defeat devices through its website and retailers since 2001.

Aaron M. Kessler contributed reporting.

A version of this article appears in print on , on Page A1 of the New York edition with the headline: U.S. Orders Major VW Recall Over Emissions Test Trickery. Order Reprints | Today’s Paper | Subscribe