Volkswagen’s diesel pollution scandal began unfolding with a series of road tests in the hills of northern Italy eight years ago. The automaker’s dirty secret was finally exposed when a team of California scientists devised a way to trick the company’s stealth software at a state-run laboratory off the San Bernardino Freeway.

The hunt for the truth behind Volkswagen’s diesel cars took more twists and turns than a joy ride down Highway 1. What began as an arcane exercise regarding the European Union’s environmental policies turned into a full-fledged scientific detective caper, led mainly by two dozen engineers and technicians at the California Air Resources Board’s test lab east of Los Angeles.

The smoking tailpipe was discovered in July. State engineers ran a series of laboratory simulations that confused a Volkswagen Passat into thinking it was on the open road. The tests established that Volkswagen diesels were engineered to run cleanly in the lab but spew copious amounts of soot and other dangerous pollutants in the real world.

Confronted with the evidence, the automaker’s senior engineering staff backpedaled from a year’s worth of denials and confessed the truth to the California air board and the U.S. Environmental Protection Agency: Volkswagen had rigged its diesel cars for years with “defeat device” software that shut off the emission-control systems during normal on-road motoring.

Sign Up and Save

“They weren’t able to explain away our data,” said Stanley Young, a spokesman for the air board. “They had simply run out of excuses as to why it was happening.”

Volkswagen’s deceit, announced by the EPA and the California board in mid-September, has exploded into a global crisis for the German automaker. The company will have to recall 482,000 diesel cars sold in the United States since 2009, and as many as 11 million cars worldwide that were implanted with the rogue software. Volkswagen is facing billions of dollars in fines and repair costs; consumers in Sacramento and numerous other cities have filed class-action lawsuits seeking damages. Prosecutors are investigating in the United States and Germany.

No one was thinking scandal back in 2007. That’s when the European Commission, the governing body of the European Union, launched a study on how best to enforce the continent’s air-pollution laws. A team of engineers at the commission’s scientific arm, the Joint Research Centre, was dispatched to test a dozen cars, half of them diesels, on the roads and highways in and around Milan.

The results, published in 2011, concluded that the EU needed to rethink its policy of relying strictly on lab tests to determine if a car was roadworthy. While the gasoline cars performed well on the road, the diesel vehicles’ emissions exceeded legal limits. The study didn’t name any of the vehicle brands involved in the test.

Follow-up tests by the Joint Research Centre, involving test drives in Sweden and the United Kingdom, produced similar findings. Diesel cars, which make up half of Europe’s new-car sales, were polluting more than expected. Of particular concern were the emissions of nitrogen oxide, or NOx, a key contributor to smog.

Everyone took VW on their word that these engines were ‘clean,’ but it took years for anyone to do some unconventional testing to figure this out.

Dave Sullivan, analyst with research firm AutoPacific Inc.

By this point, diesel vehicles were making a strong comeback in the United States. Once thought of as heavy polluters, diesel vehicles had largely disappeared from the roads in the 1990s and early 2000s, in California and across the country. But by the late 2000s, Volkswagen was leading a new generation of diesel cars that had won over regulators and motorists alike.

Consumers loved diesel’s mileage, up to 40 percent better than gasoline for some of Volkswagen’s models. Volkswagen overcame the emissions problem in part by equipping its cars with a “regeneration” system, in which a portion of the fuel is periodically diverted to burning off soot and other particles that have been trapped in a filter.

The operation of the regeneration system would later become a key factor in the emissions scandal. Dave Sullivan, an analyst with research firm AutoPacific Inc., said the system consumes fuel that otherwise would be used for propelling the car. Disabling the mechanism improves fuel mileage. Officials with the EPA and the California air board have declined to speculate on why Volkswagen was cheating.

But there’s no question the company was eager to get back into the California market, the largest in the country. That meant developing a vehicle that could meet California’s ultra-strict standards for NOx and other pollutants.

‘Diesel is back’

“Diesel is back; diesel has changed,” said Stefan Jacoby, the head of Volkswagen Group of America, during an appearance with then-Gov. Arnold Schwarzenegger at the Los Angeles Auto Show in November 2007. “Diesel is back here in California.”

The following autumn, at the start of the 2009 model year, the company began California sales of its Jetta TDI sedan – a car that appeared to run so cleanly it qualified for a $1,300-per-vehicle federal tax break under the Internal Revenue Service’s Alternative Motor Vehicle Credit program. Eventually, anywhere from 50,000 to 65,000 diesels made by Volkswagen and its Audi subsidiary would be sold in California.

Some experts in the car industry say federal and state regulators should have caught Volkswagen’s chicanery more quickly. Like their European counterparts, American officials leaned heavily on lab tests to determine if cars were behaving as promised.

“This never should have happened, and it should not have dragged out as long as it did,” said Sullivan of AutoPacific. “Everyone took VW on their word that these engines were ‘clean’ but it took years for anyone to do some unconventional testing to figure this out.”

Federal regulators eventually made a tacit acknowledgment that they should have been more vigilant. A week after announcing the Volkswagen investigation, the EPA said it would conduct road tests of all brands of diesel cars in partnership with the California air board and Canadian regulators. “We are upping our game,” said senior EPA official Chris Grundler. (European Union officials last spring approved a regular road-test program for diesel cars, to be phased in starting next January.)

But in 2011, when the initial European studies came out, U.S. officials said the reports didn’t justify launching an investigation in the United States. After all, it was common for vehicles to perform differently under road conditions compared to test labs. Young, the California air board spokesman, said regulators needed a more “definitive demonstration” that a potential problem lurked.

That evidence arrived in early 2014. Responding to the European studies, a nonprofit organization called The International Council on Clean Transportation stepped into the picture. The council, based in San Francisco, Washington and Berlin, put up $70,000 to hire a group of researchers from West Virginia University’s Center for Alternative Fuels, Engines and Emissions to road-test diesel cars in the United States.

The West Virginia crew based its study in Southern California, where it could work with engineers from the Air Resources Board. Generally regarded around the world as an aggressive regulator, the air board maintains a 400-employee lab in the Los Angeles suburb of El Monte. The state agency agreed to work with the West Virginia researchers to test the cars’ emissions in the lab to establish “baseline” data that could be compared with the road results.

Three cars were chosen for the study, representing a spectrum of different diesel engine types. Two were Volkswagens, a rented Jetta and a Passat borrowed from an area resident, and the third was a rented BMW X5.

The engineers and the organization funding the research didn’t anticipate they’d uncover any problems. Just the opposite. Because U.S. pollution laws are considerably stricter than Europe’s, the international council says it figured “the diesel cars sold in the U.S. market would be clean” and the study would show European policymakers that diesel cars could perform cleanly if they were properly regulated.

“When we started the study, the intent wasn’t to catch a manufacturer or catch any cheating,” said Arvind Thiruvengadam, an assistant engineering professor at West Virginia and one of the participants in the study.

Suspicions grow

The testing took three months. Thiruvengadam and a university research assistant, Marc Besch, drove the cars around Los Angeles and San Diego, drawing stares from fellow motorists puzzled by the web of pipes and valves strapped to the back of the vehicles. At one point they drove the VW Passat to Seattle and back, with detours to San Francisco and Sacramento for some street driving. Throughout the road tests, one of the researchers sat in the passenger seat, watching the real-time emissions data accumulate on a laptop.

They said we didn’t do the testing right; this is incorrect; ‘You don’t understand how our technology works.’

Stanley Young, California Air Resources Board

It was clear something was amiss right from the beginning. The BMW did fine, but the emissions from the Volkswagens were way out of whack compared to the lab results from El Monte.

“Something was causing the (VW) vehicles to perform differently,” Thiruvengadam said. “There had to be a reason why the vehicle didn’t perform on the road. We had our suspicions.”

Their official report, published by the international council in May 2014, identified the cars only as Vehicles A, B and C. Privately, the researchers let their hosts at the California air board know the Volkswagens were the offenders. The air board alerted the federal EPA about the problem.

Regulators from both agencies began a series of meetings with Volkswagen engineers. The company told the regulators there was nothing wrong with the cars.

“They said we didn’t do the testing right; this is incorrect; ‘You don’t understand how our technology works,’” Young said. Because of the sensitivity of the ongoing investigation, the air board declined to make any of its engineers available for interviews.

Young said engineers in El Monte redid the lab and road tests, taking into account Volkswagen’s protests, but came up with the same results. “We addressed all of their concerns, and we came back and we said, ‘Hey, we’re still finding the same syndrome here.’”

Eventually, Volkswagen officials gave in a bit, offering last winter to conduct a voluntary recall to tweak the cars’ emissions systems. In letters sent to customers in April, the company informed them it needed to install new software “to assure your vehicle’s tailpipe emissions are optimized and operating efficiently.” Estimated time to make the fix: about an hour.

Young said the remedy offered by Volkswagen affected the operation of the “regeneration” systems. Those are the mechanisms that burn off accumulated soot but are believed to hurt fuel mileage.

Volkswagen notified federal and state officials when the recall was complete, telling them the matter was resolved. The California engineers obtained a 2012 Passat and began checking Volkswagen’s work. “This is standard procedure,” Young said.

The tests, begun in May, showed the car wasn’t functioning properly. Emissions had been reduced by about 20 percent but were still well above the legal limits, Young said. A follow-up meeting with Volkswagen produced little progress; the company was insisting the problem was fixed.

“They again dismissed our data,” Young said.

Volkswagen’s denials prompted the state engineers in El Monte to intensify their efforts. The case was downright baffling. For instance, the cars performed better when the engines were cold. That’s exactly the opposite of what’s supposed to happen.

In July, the team hit on an idea that would unlock the mystery.

The air board performs lab tests using a device called a dynamometer, comparable to what’s found at commercial smog-test stations around California. The vehicle is essentially strapped to a set of giant wheels embedded in the floor. A driver executes a precise series of preset maneuvers spelled out on a computer screen: starts, stops, jackrabbit accelerations and so on. The program stays the same each time to establish apples-to-apples comparisons.

So the engineers decided to alter the program, putting the car through a different routine of stops and starts. The Passat suddenly spewed a dramatically higher level of emissions, just like on the road. The engineers realized the car was operating under two sets of commands, one for the emissions tests and one for the real world.

“We basically tricked the car into thinking it was on the open road,” Young said. “At that point, it began delivering high emissions on the test bench.”

Weeks later, Volkswagen admitted that its software was designed to cheat the emissions test.