Apple Inc. (NASDAQ:AAPL) agreed on Monday to settle a class-action lawsuit with U.S. states and consumers, who together sought as much as $840 million in damages over the company’s alleged fixing of electronic book prices.

Steve Berman, an attorney representing consumers and some U.S. states, informed the U.S. District Judge in Manhattan Denise Cote in a letter that all parties, including Apple, consumers and state attorneys general from 33 U.S. states and territories, had agreed to the settlement, Bloomberg reported, adding that the exact terms of the settlement are still unknown. The New York court also ordered both sides to submit a filing to seek approval of their settlement within one month.

In April 2012, the U.S. government sued Apple and five publishers -- Hachette Book Group, HarperCollins Publishers, Penguin Group, Macmillan and Simon & Schuster Inc -- arguing that the iPad-maker forced the publishers to sign an agreement that allowed the online retailer to sell digital copies of books under a certain pricing model that made most e-books costlier. According to the contract, the publishers determined the price of the e-books with Apple getting 30 percent of the profits, Bloomberg reported.

By reaching a settlement, Apple will avoid a trial set for July, involving cases related to a ruling last year that the Cupertino-based technology giant had planned an unlawful scheme with publishers in order to raise e-book prices. The plaintiffs sought $840 million from Apple, claiming that the company overcharged consumers by $280 million.

Apple has reportedly appealed this ruling, Monday's settlement will depend on the outcome of that appeal. 

“As set forth in the memorandum of understanding, any payment to be made by Apple under the settlement agreement will be contingent on the outcome of that appeal,” Berman wrote in the letter to the judge.