The Las Vegas City Council approved a controversial ban Wednesday that makes it illegal to camp or sleep on the streets in parts of the city, a measure critics say unfairly criminalizes homeless people.

The ordinance, which passed 5-2 after several hours of public comment, makes it a misdemeanor to rest, sleep or “lodge” in Las Vegas’ downtown district and other residential areas if shelter beds are available. Violators will be fined up to $1,000 or jailed for up to six months.

“There is very significant research and data that will confirm that public safety and criminal justice systems are the most expensive course of action for working with individuals affected by homelessness, mental illness and substance abuse,” council member Brian Knudsen, who voted against the ordinance, said during the meeting.

Knudsen represents Ward 1, which includes the city's medical district — an area that will be affected by the ban. “As a good steward of tax dollars, there are other paths that are more responsible for providing services while protecting the tax-paying public’s interests," he said.

Las Vegas will join scores of cities to impose similar ordinances when the ban takes effect Sunday. At least 160 cities across the U.S., including New York, Los Angeles and Chicago, have prohibited camping, sitting or lying down in public spaces or outdoor areas, according to a 2016 National Law Center on Homelessness and Poverty report.

Supporters say the ordinance will help keep homeless people safe and connect them with services, while also protecting businesses and residents who say the encampments negatively affect their property.

Anthony Lowe, who has been homeless since last December, talks about utilizing The Salvation Army homeless shelter near downtown Las Vegas, on Oct. 15, 2019. Chase Stevens / Las Vegas Review-Journal via AP

Critics argue that the ordinance burdens the homeless with fines and criminal records that will make it harder for them to find jobs, save for rental payments and receive government assistance. Among those who voiced opposition to the measure, two Democratic presidential candidates — former Housing and Urban Development Secretary Julián Castro and Massachusetts Sen. Elizabeth Warren.

Civil rights activists, advocates for the homeless, residents and homeless people opposing the ordinance filled almost half the chairs in 500-seat council chambers during Wednesday’s meeting. They chanted “housing not handcuffs," and many carried signs reading “surviving should not be illegal" and "where’s your compassion?" More than 100 speakers pleaded with council members to reject the ban, asking them to instead consider spending city dollars toward other solutions such as affordable housing.

Mayor Carolyn Goodman, who proposed the ordinance in September, has said that the ban is meant to encourage homeless people to go to shelters where they can receive services and help to get off the streets. She and other council members who support the ordinance have stressed that the ban will not be enforced when there are no shelter beds available in the city.

“We know this isn’t perfect,” Goodman said at Wednesday's meeting. "We’re going to find the flaws, and we’re going to fix them."

She said the ordinance is not meant to be penalty-oriented. “This is to get our homeless into an environment of re-entry into the best life in this community.”

While the ban is set to take effect Sunday, city officials say criminal penalties will not be enforced until February 1, after the city reviews additional locations for shelter needs and posts signs with details of the ban.