WASHINGTON (Reuters) - Volkswagen AG VOWG_p.DE and U.S. officials have reached a framework deal under which the automaker would offer to buy back almost 500,000 diesel cars that used sophisticated software to evade U.S. emission rules, two people briefed on the matter said on Wednesday.

The German automaker is expected to tell a federal judge in San Francisco Thursday that it has agreed to offer to buy back up to 500,000 2.0-liter diesel vehicles sold in the United States that exceeded legally allowable emission levels, the people said.

That would include versions of the Jetta sedan, the Golf compact and the Audi A3 sold since 2009. The buyback offer does not apply to the bigger, 80,000 3.0-liter diesel vehicles also found to have exceeded U.S. pollution limits, including Audi and Porsche SUV models, the people said.

U.S.-listed shares of Volkswagen rose nearly 6 percent to $30.95 following the news.

VW in September admitted cheating on emissions tests for 11 million vehicles worldwide since 2009, damaging the automaker’s global image.

As part of the settlement with U.S. authorities including the Environmental Protection Agency, Volkswagen has also agreed to a compensation fund for owners, a third person briefed on the terms said.

The compensation fund is expected to represent more than $1 billion on top of the cost of buying back the vehicles, but it is not clear how much each owner might receive, the person said.

A flag of a Volkswagen VW car dealer is seen in Bochum, Germany March 16, 2016. REUTERS/Ina Fassbender

Volkswagen may also offer to repair polluting diesel vehicles if U.S. regulators approve the proposed fix, the sources said.

A VW spokeswoman, the EPA and the Justice Department declined to comment Wednesday.

VW will pay cash compensation to owners who either sell their vehicles back or get them fixed, one of the people briefed on the matter said. Owners selling back their vehicles will get an additional cash payment on top of receiving the estimated value of the vehicles from before the emissions scandal became public in September 2015.

Owners are expected to have around two years to decide whether to sell back vehicles or get them repaired. It is not clear whether VW will be allowed to resell vehicles they buy back, the source said.

The framework deal with U.S. officials was reached after lengthy talks in recent days at the Washington law office of Robert Mueller. The former FBI director is the court appointed mediator named to help settle more than 500 civil suits filed against VW. The talks, which continued over the week, included all the government agencies and lead plaintiffs attorneys suing GM.

Some elements of the settlement are still being worked out and details are not expected to be announced Thursday at a court hearing, the people briefed on the matter said. The final deal could still change before it is officially announced, they said.

U.S. District Judge Charles Breyer in March gave VW until Thursday “to announce a concrete proposal for getting the polluting vehicles off the road.”

Breyer said in March the “proposal may include a vehicle buy-back plan or a fix approved by the relevant regulators that allows the cars to remain on the road with certain modifications.”

A final settlement is also expected to include an environmental remediation fund to address excess pollution emitted by the U.S. vehicles since 2009.

It is not clear if the deal will resolve the U.S. Justice Department’s civil suit filed in January against VW or if VW will agree to pay a civil penalty. VW also faces ongoing criminal investigations by the Justice Department and other prosecutors around the world.

Separately, Germany’s Die Welt newspaper reported Wednesday that the deal to settle the case would involve it paying each affected customer $5,000. But a person briefed on the matter told Reuters that no decisions on how individual compensation will be awarded have been made.

In December, VW said it was creating an independent claims program for owners of vehicles with excess emissions.

It named compensation expert Ken Feinberg, who administered funds for the Sept. 11, 2001 attacks, BP Plc Deepwater Horizon oil spill and General Motors Co ignition switch crashes, to create and administer the program.