Volkswagen has always been the German “people’s car,” not just by being affordable for the volk but also by being the Deutschland’s largest employer, representing almost 300,000 jobs in a country of 80 million. The automotive titan’s sudden and surprising fall from grace into scandal over the past week, then, is an economic event potentially on par with or even greater than the Greek debt crisis.

How did the economic face of such a famously rule-following people slide into one of the most brazen corporate cheating scandals of recent memory? The answer appears to be an unhealthy mixture of bad bets, worse timing, and an ill-fated attempt to export Germany’s favorite car onto American roads.

On September 18, the EPA announced that Volkswagen had been employing a “defeat device” to cheat its emission tests on the widely admired 2.0L four-cylinder TurboDiesel engines deployed in many of its smaller cars. This was the culmination of a year-long investigation after a few curious academics attempting to use VW’s cars as models for what clean diesel can achieve inadvertently found their real-world emissions to be astronomically higher than what the cars put out in the testing facility. VW’s explanations for this discrepancy gradually unraveled until the company revealed, under threat, that their cars had been cheating the entire time. The devices used to reduce emissions were turned off at all times except when the cars detected they were being tested.

Volkswagen CEO Martin Winterkorn resigned yesterday even as he insisted that he had no knowledge of the cheating. VW’s board promises that many more heads may roll, but that has not kept the company’s share prices from plummeting as regulators and criminal investigators around the world are just beginning to put the company’s practices under the microscope.

While Volkswagens have always been a significant presence in German markets, and have enjoyed relative success around the world, for decades the company has been unable to make strong inroads into the biggest, most car-mad auto market in the world: the United States of America. The now-departed CEO Winterkorn aimed to turn that trend around with a European solution to skyrocketing gas prices: clean diesel.

As demand for economical vehicles surged along with the price at the pump in the 2000s, Japanese and, to a lesser extent, American automakers were investing in hybrid technologies that allowed traditionally-fueled gasoline engines to burn less gas per mile by supplementing with electric power. The Toyota Prius became the face of hybrid automobiles and quickly spurred imitators.

VW, on the other hand, already had decades of experience making fuel-sipping diesel engines for expensive European markets, even if they hadn’t caught on in cheap-gas America. And their engineers had been hard at work on a new engine that would be coming online just in time. An apparent new era of $100-a-barrel oil and $4.00-a-gallon gasoline seemed the perfect disruptive opportunity to finally get Americans on board with diesel. The only hitch was emissions.

Diesel is a dirty fuel, which doesn’t have to be as refined as gasoline in order to compress and combust. The upside is a strong advantage in torque and fuel economy. The downside is that the burned gas contains much more particulate pollution that tends to settle near the earth, causing air pollution and asthma. European particulate emission standards are much laxer and more diesel-friendly than those in the United States, resulting in more air pollution, higher fuel economy, and lower carbon dioxide emissions. While the diesels of a decade ago were much cleaner than the black smoke-belching engines of yesteryear, the EPA imposed (possibly unreasonably) stringent new air-pollution standards in 2007, just as VW was hoping to make its diesel engines the centerpiece of its American push.

Most manufacturers responded to the new standards by equipping their vehicles with a tank of a urea solution that could be sprayed on the exhaust in order to clean it. That system took up too much space and was too expensive for the smaller, cheaper cars like the Golf and Jetta that VW was hoping to popularize, however. So they turned to a much less complicated, less expensive system: a loudly publicized NOx trap combined with exhaust gas recirculation. The first uses unburned fuel to clean its filter, worsening fuel economy, and the latter degrades engine performance, worsening power. VW’s TDI engines have been cherished for providing ample amounts of both economy and power, and now it appears we know why.

When it came time to hit the U.S. market with its new engines, VW seemed to have trouble delivering, announcing instead that the Jetta TDI would be delayed six months after encountering what was widely rumored and reported to be emissions issues. They soon hit the market, however, and for several years the company enjoyed surging success selling VW’s as a hip Euro alternative car that was clean-diesel green to boot. Until it wasn’t.

It appears that Volkswagen took a gamble on its ability to produce an economical, powerful, clean diesel engine via technology that just couldn’t deliver by the time the EPA’s deadline arrived. Too much money, publicity, and planning had been invested in the “blue” diesel engines to abandon them, but rolling out a fleet of new diesel cars with the mediocre fuel economy and/or the exhaust-choked engines it would take to meet the EPA’s demands could have been even more embarrassing for proud German engineering.

And so, under the pressure to produce an engine that could be all things to all people without compromises, someone along the highly centralized Volkswagen production line cracked. Maybe VW’s engineers were just buying time to rush a urea-based system and were hoping no one would notice their hack-job in the interim. Perhaps significantly, in retrospect, VW had already begun implementing the more common urea-based system when the cheating scandal came to light. But whether it was one engineer taking a shortcut with programming, or, what seems more likely, an entire team out of answers and desperate to meet their goals, Volkswagen’s fleet of nimble TDI’s were programmed to monitor themselves and detect an emissions testing-like situation; only then were the cars to switch on their “clean diesel” facade.

With the few lines of engine management software coding that it took to program the Volkswagen EPA “defeat device,” then, Germany’s iconic national brand, the largest company of its largest industry, a company whose largest shareholder is still the regional government of Lower Saxony, has now been laid low. What’s more, when Martin Winterkorn looks back on the scandal that felled him as CEO mere weeks after he had beaten back an internal coup attempt from the chairman of the board, he will see the bitter truth that, even if VW had never been caught, their U.S. gambit was already failing.

A few years ago the strategy was seemingly peaking in success, as “[b]rand-wide volume in 2012 improved to the highest level since 1973, when Type 1 Beetles filled the driveways of America.” VW’s growth almost immediately hit the skids, however, and hobbled for years with outdated models, the company saw double-digit declines quarter after quarter.

What’s more, the seeming new normal of $4.00 gas as far as the eye could see that was so evident as 2012 set American gas price records, proved to be a high-water mark. Global oil prices have been falling thanks to booms in domestic American production via shale gas extraction and fracking techniques. The shifts in American sentiment towards small, fuel-efficient cars to which VW offered a new lease on diesel life soon tracked back to the bigger cars, trucks, and SUVs the country famously preferred. Belatedly, Winterkorn announced this year that VW would be trying to play catch-up and aggressively enter the SUV and crossover market.

Ironically, diesels are a natural fit for SUVs, where their “torquiness” and fuel-economy can both be put to good use. Volkswagen’s reputation will presumably be shot for years to come, however, especially if they start “fixing” people’s cars by turning the emissions traps on all the time, draining the vehicles of fuel economy and power. And the slowly recovering reputation of diesel fuel in the U.S. may have been set back by another 10 to 20 years.

Volkswagen itself will be beset by criminal investigations, angry regulators, and opportunistic class-action lawsuits the world over. The company has already set aside $7.3 billion to address those claims. Only time will tell if it will be enough. Already there is sweeping fear in Germany of potential layoffs as the industrial icon of Europe’s steadiest and strongest economy suddenly finds itself under peril.

Angela Merkel presides over a country that has girded itself against the Greek economic crisis, promised that it could absorb vast numbers of refugees from that current crisis, withstood the economic disruptions resulting from Russia’s invasion of Ukraine, and prepared to weather the presumed depressed demand to result from China’s stock collapse. Yet for all the world has thrown at it, Germany finds itself economically rocked by a few lines of car software code thrown in by panicked engineers trying to satisfy the EPA and California Air Resources Board.

Jonathan Coppage is an associate editor at The American Conservative.