New York —

Meta said Wednesday it 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.

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, according to a court filing. The nearly $18 billion payment will provide funding for state “youth online safety initiatives,” according to the company.

The agreement 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.