The ordinance consolidates consolidate city bans on discrimination based on sex, race, age, religion and other categories and increases protections for gay and transgender residents. It takes effect in 30 days.

The Houston City Council voted 11-6 in favor of the ordinance to loud cheers inside their chambers. Fewer than 30 people spoke against the measure during a public hearing that lasted more than seven hours. The council chambers and an overflow room were packed for Wednesday’s hearing, and more than 200 people spoke.

Supporters, including Mayor Annise Parker, said the measure is about offering protections at the local level against all forms of discrimination in housing, employment and services provided by private businesses such as hotels and restaurants. But debate about the measure focused largely on provisions regarding rights for gay and transgender citizens.

Parker, who is gay, said passing the ordinance was not the most important thing she has done in office but the “most personally meaningful thing I will do as mayor.”

Those who protested the ordinance, including various local pastors, said it’s unconstitutional and would infringe on their right to speak out against homosexuality. They argued residents in the nation’s fourth-largest city should be allowed to vote on the issue through a referendum.

“I believe this ordinance is really about stepping on some people’s freedoms,” Houston resident Stephanie McHugh told the council.

McHugh said businesses and churches would be forced to recognize ideas that are against their beliefs, though officials said religious institutions would be exempt from the law.

Most who spoke in favor of the ordinance highlighted the protections it would offer to members of the gay, lesbian and transgender community, offering stories of discrimination they have suffered.

“If Houston wants to be considered a community that values all of its citizens, this ordinance should be passed today,” said Robert Brewer, a Houston attorney who identified himself as gay.

James Douglas, a vice president with the Houston branch of the National Association for the Advancement of Colored People, said his organization supports the ordinance.

“I hope this struggle will not be as long as the struggle for racial equality in this country,” Douglas said.

Houston becomes the last major city in Texas to adopt such an ordinance. San Antonio passed a similar measure that was heavily disputed last year.