NEW YORK (AP) -- Apple will pay up to $400 million to compensate consumers ensnared in a plot to raise the prices of digital books unless the company overturns a court decision attesting to its pivotal role in the collusion.

The terms of the settlement disclosed in a Wednesday court filing came a month after the attorney suing Apple notified U.S. District Judge Denise Cote that an agreement had been reached to avert a trial.

Lawsuits filed on behalf of digital book buyers had been seeking damages of up to $840 million for a price-fixing scheme that Cote ruled had been orchestrated by Apple

Apple is appealing Cote's decision. The Cupertino, Calif., company won't have to pay the $400 million settlement if it prevails.

Five major book publishers previously reached settlements totaling $166 million.

The Motley Fool recommends Apple. The Motley Fool owns shares of Apple. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.