SANTA ANA — A federal judge on Tuesday demanded that local government and activists find a way to help hundreds of homeless people camped along a California trail before he forces them to move from the site.

In an unconventional hearing, U.S. District Judge David O. Carter called on Orange County officials, veterans, women's advocates and others to step up and offer solutions for those living on a two-mile stretch of riverbed trail once popular with joggers and bikers that has been overrun by tents, trash and human waste.

Attorneys were given two hours to try to work out a possible solution. If they don't, Carter said he plans to barrel forward with a hearing that could last days and include a visit to the encampment.

Carter challenged those in his courtroom to come up with money and lodging after the county moved last month to shut down the encampment along the Santa Ana River.

He asked why temporary housing couldn't be built quickly, when he has seen villages built overnight with U.S. funding in Afghanistan.

"Where is the leadership to get this done in this county potentially? Where is the long-term solution here?" he asked.

The case is being watched by homeless advocates along the West Coast and elsewhere grappling with a rise in homelessness caused in part by soaring housing costs, rock-bottom vacancy rates and a roaring economy.

The ruling will only cover people living in the encampment near the stadium that hosts the Los Angeles Angels, but homeless advocates elsewhere might look to the case to make similar claims, experts said.

Orange County, home to 3.2 million people between Los Angeles and San Diego, started telling the homeless last month officials were closing the encampment of tents and tarps and offering to store belongings and help find shelter.

Homeless advocates sued and sought protection from the courts when they heard authorities were going to start citing or arresting people who refused to budge.

Carter temporarily blocked officials from making arrests.

During Tuesday's hearing, he peppered advocates and county workers with questions about programs, policies and budgets.

Get news headlines sent daily to your inbox

He said he believes Orange County has enough money to find a fix and should be spending it.

He also said a cluster of cities near the riverbed should help after pushing the homeless off their streets and sidewalks to the county-owned trail.

County Supervisor Andrew Do said officials have identified land in Santa Ana that might provide a space where tent-dwellers could be moved for the time being.

Since relocation efforts began, about 30 percent of tents have been moved, according to the county.

Workers collected more than 400 pounds (181 kilograms) of human waste and more than 2,200 syringes in a two-week period, according to court filings by county attorneys.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.