New York —

Meta has agreed to an about $18 billion settlement to resolve claims brought by 29 state attorneys general that it intentionally designed addictive platforms that harmed young people’s mental health, according to a court filing Wednesday.

The settlement ends a landmark legal battle for the social media giant.

As part of the settlement, Meta has agreed to make changes to its platforms, such as establishing daily time limits for teen users, the filing states. The payment will go toward

It comes just over a week after a trial began in California, in which four of the states were seeking as much as $1.4 trillion in damages and changes to the company’s platforms. Instagram head Adam Mosseri was set to take the stand for a second day on Wednesday, and Meta CEO Mark Zuckerberg was also expected to testify in the case.