German car giant Volkswagen (VW) has been ordered to pay out almost $15 billion (£12.3bn) in the United States as a result of the diesel emissions scandal which has rocked the company.

The settlement, ordered by San Francisco District Judge Charles Breyer, is thought to be the largest court order related to automobiles in US history.

Some $10 billion of the costs will be made available to allow VW owners to sell affected vehicles back to the company or have them repaired at the company's expense. $2.7bn will go towards environmental mitigation and a further $2bn will be spent promoting zero-emission vehicles.

Additionally $324m will go on attorney's fees and $8.5m in "out of pocket" costs.

Judge Breyer's ruling relates to 2.0 diesel models of the company's VW Beetle, Golf, Jetta, Passat and Audi A3 models, manufactured between 2009 and 2015.

Around 490,000 owners will receive the planned compensation and to date, 340,000 have signed up for settlement. Later, VW will also have to pay out on 3.0 models as well as lawsuits from at least 16 US states, according to Reuters.

CEO and President of VW America, Hinrich Woebcken, hailed Breyer's ruling as "an important milestone in our journey to making things right in the United States."

He went on: "Volkswagen is committed to ensuring that the program is now carried out as seamlessly as possible for our affected customers and has devoted significant resources and personnel to making their experience a positive one."

volkswagen emissions scandal USA 2016
An American flag flies next to a Volkswagen car dealership in San Diego, California (file photo) REUTERS/Mike Blake

VW will begin buying back affected vehicles from November (2016) and under the settlement must have fixed or bought back 85 per cent of vehicles by June 2019 or face additional costs.

However, some VW owners said they thought the company had got off lightly. Blair Stewart, a Californian owner of a Jetta wagon, was quoted by Mail Online as saying: "This is not enough to deter the kind of behaviour they did."

The scandal involves tests for harmful diesel emissions , which were fixed by the company to make them seem lower than they were. Special software was attached to cars before they were tested on treadmills, but this software was removed before the cars went on the road.

The US Environmental Protection Agency (EPA) calculated the scheme allowed some models of VW car to emit 40 times the safe levels of nitrogen oxide, according to CBS San Francisco.