A federal judge approved an agreement that will mandate the city and county of Los Angeles to provide housing for up to 7,000 homeless people living near freeways in an effort to put a dent in the region's homeless crisis, officials said Thursday.

Under the terms, the city will provide 6,000 beds to the homeless within 10 months and another 700 over 18 months. The county will spend $300 million over five years to fund much-needed services for those being housed. The housing will be provided to those living near freeways, homeless people over 65 and those at risk for COVID-19.

“The court has challenged us to do better, to do more and to do it quickly, and we need to meet that challenge. We are now positioned to dive into difficult but honest conversations with our county partners about future financial resources and obligations,” Los Angeles City Council President Nury Martinez said in a statement.

LA HOMICIDES UP BY 250 PERCENT OVER LAST WEEK, LAPD REPORTS

U.S. District Judge David O. Carter previously ordered both the city and county to relocate anyone camped within 500 feet of a freeway into a shelter or alternative housing. As a result of the agreement, he has agreed to drop his preliminary injunction, according to a joint statement from Martinez and Los Angeles County Supervisor Mark Ridley-Thomas.

The action involves a lawsuit filed in March by the LA Alliance for Human Rights, which accused officials in greater Los Angeles of failing to address the homelessness crisis.

Los Angeles County has struggled with a rise in homelessness for years, which is further compounded by the region's expensive cost of living. A January count revealed the county had more than 66,400 homeless people, a nearly 13 percent increase from last year's point-in-time count.

This file photo shows a homeless encampment at the corner of Wilshire Boulevard and Beaudry Avenue along the 110 Freeway during the coronavirus outbreak in downtown Los Angeles. A judge has approved an agreement in which the city and county of Los Angeles will provide housing for almost 7,000 homeless people who live near freeways. (AP Photo/Mark J. Terrill, File)

This file photo shows a homeless encampment at the corner of Wilshire Boulevard and Beaudry Avenue along the 110 Freeway during the coronavirus outbreak in downtown Los Angeles. A judge has approved an agreement in which the city and county of Los Angeles will provide housing for almost 7,000 homeless people who live near freeways. (AP Photo/Mark J. Terrill, File)

The city of Los Angeles saw a 14 percent rise to 41,290 homeless people, according to the Los Angeles Homeless Services Authority.

Carter said those living near freeways posed a special risk from exposure to pollution, lead and the possibility of being injured by a vehicle or earthquake. He also noted that their camps block sidewalks.

Options for housing include shared housing, hotels, tiny homes, 3D-printed homes and huge tents called sprung structures, according to the lawsuit.

A homeless encampment atop the Main Street overpass of the 101 freeway during the coronavirus outbreak in downtown Los Angeles. (AP Photo/Mark J. Terrill, File)

A homeless encampment atop the Main Street overpass of the 101 freeway during the coronavirus outbreak in downtown Los Angeles. (AP Photo/Mark J. Terrill, File)

CLICK HERE TO GET THE FOX NEWS APP

The judge said he will still consider a lawsuit demanding the finding of beds for 64,000 people in the county, said Elizabeth Mitchell, an attorney for the Alliance.

“This was a very exciting step. We’re very pleased,” she said. “But we hope that these kinds of smaller agreements will be wrapped into a larger agreement addressing the overall problem.”

The Associated Press contributed to this report.