Meta agreed Wednesday to pay up to US$18 billion and add stronger child-safety measures to its Facebook and Instagram platforms as part of a landmark legal settlement.

The settlement ended a trial over teen social media addiction and settled claims filed by nearly every US state.

It resolved a pivotal case years in the making that sought to hold the tech giant accountable for the role its platforms played in undermining children’s mental health.

If approved by the court, the deal will stop an avalanche of litigation by states against Meta.

However, the company still faces lawsuits from individuals and school districts throughout the U.S.

For the states, the settlement delivers money for mental-health programs for kids, including after-school or summer activities and digital literacy counselors.