LOS ANGELES (AP) — The Los Angeles Unified School District will direct $151 million to 50 schools to settle a lawsuit over how the nation's second-largest school system spends money intended for its neediest students, according to a settlement announced Thursday.

The funds will be funneled over three years to schools in neighborhoods mostly in South and East Los Angeles and will be aimed particularly at low-income students, English learners and foster youth.

Nearly all the students at the 50 campuses named in the settlement are in those targeted groups.

The money will help boost tutoring, mental health support, counseling and parent participation.

The settlement ends a lawsuit filed in 2015 by parent Reyna Frias and groups including Community Coalition. It accused the district of misspending up to $450 million a year — using that money for general operations instead of to benefit the targeted students.

Over time, the accounting practice would have resulted in more than $2 billion in lost funds for services for high-need students, according to the plaintiffs.

Frias said she was "overjoyed" and Community Coalition's Aurea Montes-Rodriguez said the settlement would "immediately improve the lives of students across Los Angeles."

The LAUSD was pleased by the outcome, said the district's general counsel, David Holmquist.

"The result of this settlement provides a tremendous opportunity to direct more resources to our highest-need students and schools," he said.