Apple will pay up to half a billion dollars to settle a class action lawsuit accusing it of slowing down older iPhone models to compel users to buy new ones. The proposed settlement agreement requires Apple\n \n (AAPL) to pay the owners of certain iPhone models $25 per affected device, totaling a minimum of $310 million and a maximum of $500 million, according to documents released on Friday in US District Court in San Jose, California. The amount each user receives could increase or decrease depending on how many claims are filed as well as any additional legal fees and expenses approved by the court, the document added. The settlement agreement, which is subject to approval by a judge on April 3, caps a legal battle that’s gone on for more than two years during which Apple tried to ease a global backlash. The company admitted in December 2017 that it used software updates to slow down older iPhones, soon after angry customers and tech analysts flagged that the updates were causing diminished performance. Some of them suggested that Apple did so to force users to upgrade to the latest iPhone model, but the company said it was aimed at addressing issues with older lithium-ion batteries that would make the phones suddenly shut down to protect their components. Apple later apologized and offered battery replacements to its customers for $79, which it knocked down to $29 in January 2018. The company’s CEO, Tim Cook, admitted a year later that revenue for 2018 was partly hit by “significantly reduced pricing for iPhone battery replacements.” iPhone users in the United States can file settlement claims if they owned an iPhone 6, 6 Plus, 6S, 6S Plus, 7, 7 Plus or SE device bought before December 21, 2017. Apple did not immediately respond to a request for comment on Monday.