Las Vegas officials passed a law Wednesday making it a crime for homeless people to sleep on streets or sidewalks when beds are available at city-sanctioned shelters.

The 5-2 council vote came after a day of drama that included Mayor Carolyn Goodman throwing out several audience members whom she deemed disruptive.

Most of the people who showed up to the meeting spoke against the measure, which applied to Las Vegas' downtown urban core but not the tourist-heavy Las Vegas Strip, overseen by a different jurisdiction.

Before the 9-hour meeting, about 100 people rallied, chanting, "The war on the poor has got to go."

Goodman, the sponsor of the proposal, called the new law imperfect but said it was necessary to deal with the city's growing homeless crisis.

"This is flawed but it is a start," Goodman said, adding that the city has been dealing with the homeless for years and that "we must have results."

DRUNKEN FRONTIER AIRLINES PASSENGER PUNCHED PILOT AT VEGAS AIRPORT, OFFICIALS SAY 

Critics of the law rejected city officials' assurances that there would be enough shelter space when necessary and said the measure was an attack on the city's homeless population.

"It's criminalizing the homeless," Rev. Leonard Jackson, an associate pastor at First African Methodist Episcopal Church in North Las Vegas and director of the regional Faith Organizing Alliance, said during the morning protest outside City Hall.

It was not immediately clear if the law would be challenged. Last year, the 9th U.S. Circuit Court of Appeals struck down a similar law from Boise, Idaho, calling it unconstitutional to prosecute people for sleeping in public areas when there weren't enough shelter beds. However, Las Vegas City Attorney Brad Jerbic said the new law was crafted to withstand similar legal challenges with its "if beds are available" provision.

CLICK HERE FOR THE FOX NEWS APP

The Vegas law would provide for warnings by public officers, beginning Sunday, for people found "camping, lodging, sitting, lying down, sleeping and similar activities" in most downtown areas.

Las Vegas was just the latest Western city trying to deal with a spike in homelessness. Los Angeles, San Francisco, Seattle, Portland, Ore., and Oakland all have been grappling with soaring numbers and very few ways to make real impact.

The Associated Press contributed to this report.