Volkswagen will settle its emissions scandal case for $14.7 billion, the largest payout by an automaker to consumers in U.S. history, in an agreement set to be formally announced Tuesday morning, according to two people familiar with the matter.

More than $10 billion of the settlement will go to fix or buy back 475,000 Volkswagens with two-liter diesel engines that were programmed to turn off emissions measurement data outside of laboratory settings, the people said, speaking on condition of anonymity because the deal had not yet been announced. Those engines spewed 40 times the legal limit of harmful nitrogen oxides.

Another $2.7 billion will go into an Environmental Protection Agency trust fund for environmental remediation, and the German automaker will spend $2 billion more on American clean energy technology.

Nearly 40 state attorneys general are also set to announce resolutions with Volkswagen that could bump the total settlement valuation to more than $15 billion.

A criminal investigation into the 2015 “diesel-gate” scandal, one that impacted 11 million vehicles worldwide, is pending.

“This is not a slap on the wrist kind of thing,” said Erik Gordon, a professor at the University of Michigan Ross School of Business. “It’s a big financial setback and a big reputational setback. This is more than an annoyance for VW. It’s going to force VW to do some triage for its future.”

Car owners have the option of selling their vehicles back to VW at pre-scandal prices or to have the emissions software fixed free of charge. Aside from that compensation, those drivers are also eligible to receive between $5,100 and $10,000 in the settlement.

Consumers who sold or traded in their vehicles are also entitled to compensation, even if the current owners are also being compensated.

The buy-back and fix program runs through Dec. 1, 2018. By then, the settlement requires Volkswagen to have replaced or repaired 85 percent of the affected cars or pay hundreds of millions of dollars more in federal fines.

Once hailed as a leader in efficient “German engineering,” the company’s reputation has gone through the ringer after the massive scandal and settlement, industry analysts say. And the monetary penalties, with more to come from the Justice Department and European regulators, have dealt a sizeable blow to one of the auto industry’s most admired brands.

“The PR piece is such a huge piece especially because people relied on these green cars, and now they feel cheated,” said Carl Tobias, a professor of law at the University of Richmond. “I think the pressure was so intense that they weren’t paying attention or cut corners or cheated. You just can’t do that. It won’t fly in the U.S. with our consumers and our agencies. I just don’t think VW reckoned with that or did not take it seriously until it was too late.”

The settlement is the latest massive fine imposed by federal environmental and safety regulators on big companies, dating back to the $20.8 billion settlement with BP over the 2010 Deepwater Horizon oil rig explosion. BP also paid $4 billion in criminal fines.

In 2012, Toyota paid $1.1 billion after after its gas-pedal recall.

In 2015, General Motors agreed to pay $900 million after an ignition-switch defect.

Takata has yet to reach a settlement with regulators over its massive air bag recall.

“The Department of Justice is on a real streak, but the car-makers have given them some good material,” Gordon said. “The car companies have really coughed up an amazing series of bad acts.”

Volkswagen executives have begun evaluating where to make spending cuts in the wake of the fines, targeting first wages for German workers and research and development of new models.

Those are drastic cuts for an automaker, Gordon said, because without new models, sales can decline, making investors hesitant to bankroll the company.

“Investors’ biggest problems are getting at how many cars VW is able to sell when it can’t sell a lot of diesels, when it’s a decade behind on electric cars and it’s not going to sell a lot of new models,” he said. “That’s the kind of thing that can cut your value in half.”

Stephanie Walkenshaw, of Denver, purchased her 2014 Jetta SportWagen TDI months before news of the emissions scandal broke. Until recently, after trying to claim some remittance from Volkswagen, she said she’d have preferred to keep her car after getting it fixed.

Now, she says, she’ll never buy a VW again.

“I thought VW preyed on people’s good intentions and that’s one of the worst things you can do,” she said. “I wanted a car that had power but that was also good for the environment. They preyed on exactly what I wanted.”