Nathan Bomey

USA TODAY

Volkswagen has reached a settlement in principle with the U.S. Environmental Protection Agency, California officials and consumers over a plan to fix or buy back nearly half a million vehicles that violated emissions standards, a federal judge said Thursday.

The deal includes "substantial compensation" for owners of cars powered by two-liter "clean diesel" engines that were fitted with software to cheat emissions tests, U.S. District Judge Charles Breyer said in a hearing from a courtroom in San Francisco.

The accord could finally bring about a solution to a technical crisis that has bedeviled Volkswagen engineers, who have been unable to deliver a fix that was acceptable to the EPA.

Consumers will be allowed to sell their vehicles back to Volkswagen or get repairs, the judge said. But financial details of the offer, which is still being finalized, were not disclosed.

"It looks like they’re moving forward in good faith and will be compensating consumers," said Carl Tobias, a product liability law professor at the University of Richmond. "If it’s substantial compensation, that probably helps on the PR front."

Breyer issued a gag order and scolded parties for leaking previous details to the media, which included news reports of $5,000 in compensation totaling some $1 billion for some VW car owners.

Breyer said that former FBI director Robert Mueller, who was appointed to pursue a settlement, had reached an agreement with all the major parties, including the EPA, California Air Resources Board and a group of consumers who filed lawsuits against the automaker on behalf of all affected VW diesel owners.

"There is definite momentum to resolving these issues," Breyer said.

The cost to buy back all of the cars affected by the scandal would be more than $7 billion, Kelley Blue Book estimated.

One immediate question, however, is whether VW owners themselves will embrace the deal.

"Almost all of them I know personally don’t want to do anything to their car," Kelley Blue Book analyst Karl Brauer said. "They don’t want to get rid of it because they like it and they don't want to get it fixed because they like how it drives."

Volkswagen will also be required to invest funds to "promote green automotive" initiatives and establish an environmental remediation fund after years of cars spewing nitrogen oxide emissions at harmful levels, the judge said.

Justice Department attorney Joshua Van Eaton said the Federal Trade Commission is also expected to support the deal. The FTC recently sued Volkswagen over the German automaker's "clean diesel" advertising, which the agency called deceptive.

Breyer set June 21 as a deadline for the parties to file preliminary proposals on the settlement, after which the public will have a chance to comment before he signs off.

The agreement helps Volkswagen avoid a trial over the emissions violations and economic losses to consumers, which Breyer had threatened to schedule if VW did not meet Thursday's deadline to reach an agreement.

Attorneys for the U.S. government, state regulators and consumers worked 14 hours a day, seven days a week since a March 24 hearing to reach a deal, the judge said.

"Volkswagen is committed to earning back the trust of its customers, dealers, regulators and the American public," the automaker said in a statement after the hearing. "These agreements in principle are an important step on the road to making things right. Volkswagen intends to compensate its customers fully and to remediate any impact on the environment from excess diesel emissions. As noted today in court, customers in the United States do not need to take any action at this time."

To be sure, the agreement is far from the end for Volkswagen's emissions scandal. For starters, the Justice Department is conducting a criminal investigation into Volkswagen's intentional evasion of emissions standards, which was first exposed by the EPA and California Air Resources Board in September.

Tobias said it's likely Volkswagen will seek to strike a criminal settlement, as well, which he said is likely to come with billions in fines.

The company is also facing several investigations in Germany, its headquarters, where it has much larger sales. Volkswagen confirmed that the deal "will have no legal bearing" on proceedings outside of the U.S.

Analysts have estimated that the company could be forced to spend tens of billions in fines, repair costs and settlements. Bloomberg reported that the settlement would likely cost at least $10 billion.

Volkswagen executives have said that fixing the older models requires significant hardware changes that are hard to achieve, making it difficult to reach emissions compliance. The affected vehicles range from the 2009 through 2016 model years, including the Jetta and Passat sedans.

"Effectively we're going to see lots of buybacks and not much by way of retrofitting," Tobias said.

The scandal also involves about 80,000 3-liter diesel vehicles, including Audi sedans and Porsche crossovers. Those vehicles are not included in the agreement.

"It is the court’s expectation that the parties, in addition to finalizing the agreements that I just discussed, will work expeditiously on resolving these outstanding issues," Breyer said.

Follow USA TODAY reporter Nathan Bomey on Twitter @NathanBomey.