Volkswagen has agreed to take a series of steps costing about $10.2 billion to settle claims from its unprecedented diesel emissions cheating scandal in the U.S., two people briefed on the matter said Thursday.

Most of the money would go to compensate 482,000 owners of cars with 2-liter diesel engines that were programmed to turn on emissions controls during lab tests and turn them off while on the road, said the people, who asked not to be identified because a judge has issued a gag order in the case.

One of the people said the agreement was tentative and could change by the time the terms are officially announced by the judge on Tuesday. The bulk of the cash would be used to fix the cars, buy them back and compensate owners. Some funds would go to government agencies as penalties and for a program to remediate the environmental damage caused by pollution, the person said.

Owners would have a choice between selling their vehicles back to VW at the value before the scandal broke on Sept. 18, 2015, or keeping the cars and letting the company repair them for free. Either way, they would also get $1,000 to $7,000 depending on their cars' age, with an average payment of about $5,000, one of the people said.

Attorneys representing owners, VW and government agencies including the Environmental Protection Agency have not yet agreed on the steps VW will take to repair the cars, the person said. Any fix likely would require a bigger catalytic converter or injection of the chemical urea into the exhaust to help neutralize the pollution.

The $10.2 billion cost eclipses costs of all recent automotive scandals. General Motors, for instance, paid roughly $6.9 billion for its giant recall of defective ignition switches two years ago. But unlike other scandals, VW has admitted to deliberately deceiving government regulators.

The EPA has said the cars, which include many of VW's most popular models, can give off more than 40 times the legal limit of nitrogen oxide, which can cause respiratory problems in humans. Around 11 million cars worldwide also had the cheating software, but nitrogen oxide emissions standards aren't as stringent outside the U.S.

Neither VW spokeswoman Jeannine Ginivan nor EPA spokesman Nick Conger would comment on the settlement.

VW may have to pay additional penalties to government agencies, one of the people said. The Justice Department has sued VW on the EPA's behalf, and the automaker could also be penalized by the California Air Resources Board and the Federal Trade Commission, which has sued over false advertising claims.

Volkswagen owners filed dozens of lawsuits against VW after it acknowledged in September that it intentionally defeated emissions tests and put dirty vehicles on the road.

The company faces as much as $20 billion in fines for Clean Air Act violations alone, on top of paying to fix the cars or compensate their owners.

The settlement does not include 3-liter Volkswagen diesels, which had another version of cheating software.

Full details of the settlement are scheduled to be released Tuesday by Senior U.S. District Court Judge Charles Breyer in San Francisco.