Apple has settled out of court with the 33 US states and territories that had been seeking up to $840m in damages for its ebook price-fixing shenanigans.

The fruity firm, which was found guilty of engaging in the price-fixing conspiracy with five major book publishers in a separate trial, has always maintained its innocence and fought hard against the allegations.

Even after Penguin, HarperCollins, Macmillan, Simon & Schuster and Hachette settled the earlier case with the US Department of Justice, Apple fought on and is still in the process of appealing the guilty verdict.

Apple also tried to get the damages case dismissed, or at least delayed until after its appeals were heard, but the courts said last month that the trial to decide on the size of the payouts to the US states should go ahead.

However, the company caved to the class action lawsuit today, avoiding the trial that could have seen it landed with an $840m bill if the full awarded damages were tripled.

The terms of the settlement, which still has to be approved by the court, have not been revealed.

The five publishers previously agreed to settlements worth around $167m, after US state attorneys general filed lawsuits on behalf of their local ebook consumers.

Although Apple has negotiated a settlement on the terms of the damages, it hasn’t written the cheques yet. The firm’s lawyer told Judge Denise Cote that any money in the agreement would only be handed over if Apple loses its appeal against the guilty decision.

The judge has ordered the parties to get their filings in for court approval for the settlement within 30 days.