Over fierce objections from homeless advocates and service providers, Fremont, the Bay Area’s fourth-largest city, has adopted one of the strictest camping bans anywhere in the region and California.

In a 6-1 vote Tuesday night, the City Council approved the ordinance, which prohibits camping on all public property and allows prosecutors to criminally charge anyone “aiding” or “abetting” a homeless camp.

The penalty for violating the new law is a fine of up to $1,000 and up to six months in jail. It takes effect in 30 days.

Fremont officials have maintained the goal is not to criminalize homelessness but instead to give officials the “power to change behavior” of those living in encampments. They say they have no intention of arresting homeless people or service providers.

Mayor Raj Salwan said city officials will continue working with local nonprofits and the county to provide mental health and addiction services and help find housing for the city’s estimated 600 homeless people living on the street. The city has one homeless shelter with only about 45 beds.

“The question is how do we balance compassion with accountability,” Salwan said during Tuesday’s council meeting.

Fremont residents, frustrated with sprawling encampments that cause fire hazards and pollute waterways, gathered more than 1,600 online signatures in support of the ban.

Advocates, meanwhile, have assailed the measure as cruel and counterproductive. They’ve raised concerns the aiding-and-abetting provision could deter nonprofits and community groups from helping those in encampments and discourage homeless people from accepting needed services.

Fremont officials, however, say the provision is not uncommon, and that some other cities, such as Berkeley, Hayward and Sunnyvale, have general language in their municipal codes prohibiting the aiding and abetting of any crime.