After nearly nine hours of chanting and tears from seas of opponents and supporters in color-coded T-shirts, Houston City Council passed an ordinance on Wednesday extending equal rights protections to gay and transgender residents.

Despite weeks of discussion and dissent over the measure, the final vote was 11-6, a count that matched guesses made months ago, when Mayor Annise Parker — the first openly lesbian mayor of a major American city — said she planned to bring forward such a measure.

The approval was greeted with thunderous applause from the audience, largely full of supporters, and chants of "HERO," for the Houston Equal Rights Ordinance.

"While much of the debate has centered around the gay and transgender section of the ordinance, it is a comprehensive ordinance," Parker said after the vote. "It is a good step forward for the city of Houston."

The measure bans discrimination based not just on sexual orientation and gender identity but also, as federal laws do, sex, race, color, ethnicity, national origin, age, religion, disability, pregnancy and genetic information, as well as family, marital or military status.

The ordinance applies to businesses that serve the public, private employers, housing, city employment and city contracting. Religious institutions would be exempt. Violators could be fined up to $5,000.