Police in Modesto, California, reported on Tuesday that they were collaborating with the volunteer group Operation 9-2-99 in removing trash from the Tuolumne River over the weekend when they discovered the cave dwellings.

Local media said there were eight caves equipped with beds, tables and chairs, shocking neighbors who were unaware how elaborate the dwellings were.

Modesto police said the people living in the riverbank area had been notified of the cleanup ahead of time and they were offered services to transition into housing.

Upon learning about the caves, city and state officials implemented "immediate safety measures" and restricted access with barricades and temporary fencing while assessing the structural safety of the surrounding areas, the city of Modesto said in a statement on Wednesday.

"The City recognizes the importance of not only addressing the immediate safety risks but also working towards a comprehensive solution to permanently eliminate these caves," the city statement said.

Homelessness has remained a stubborn problem in much of California, which had a homeless population of more than 180,000 as of a year ago, according to a U.S. Department of Housing and Urban Development estimate.

Operation 9-2-99, so named for targeting an area of the river from the 9th Street Bridge to Highway 99, has been helping restore the Tuolumne since 2014, according to its website.

The city of about 220,000 people is at the northern end of the agricultural San Joaquin Valley about 90 miles (145 km) east of San Francisco.

(Reporting by Reuters; Editing by Michael Perry)