Editor's note: This story has been updated throughout.

Delivering a hit to the Texas gay rights movement, Houston voters on Tuesday resoundingly rejected an ordinance that would have established protections from discrimination for gay and transgender residents and several other classes.

With 95 percent of votes counted, 61 percent of voters opposed the measure. The embattled ordinance, better known as HERO, would have made it illegal to discriminate against someone based on 15 different “protected characteristics,” including sex, race, religion, sexual orientation and gender identity.

Supporters hoped the ordinance would align Houston with other major cities with similar measures in place. But opponents successfully attacked the measure with arguments about bathrooms.

The Texas Tribune thanks its sponsors. Become one.

Dubbing it “the bathroom ordinance,” they argued the ordinance’s gender identity protection would allow sexual predators to enter women’s bathrooms. Outside of polling places, signs read “NO Men in Women’s Bathrooms.” And television ads bankrolled by opponents depicted a young girl being followed into a bathroom stall by a mysterious older man.

Ahead of Tuesday’s vote, Republican state leaders, including Gov. Greg Abbott and Lt. Gov. Dan Patrick, cited the bathroom arguments in lending their political muscle to the campaign opposing the ordinance. On Tuesday, Patrick attributed the defeat of the “misguided” ordinance to voters standing up to “pandering to political correctness.”

“The voters clearly understand that this proposition was never about equality – that is already the law,” Patrick said. “It was about allowing men to enter women’s restrooms and locker rooms — defying common sense and common decency.”

Supporters of the ordinance called the strategy fear-mongering and hoped for a win even after early voting figures showed the ordinance behind by a wide margin.

In a joint statement, the coalition of organizations that campaigned in support of the ordinance as part of the Houston Unites campaign, including Equality Texas, the ACLU of Texas and the Human Rights Campaign, said the fight for nondiscrimination measures was not over.

"We've learned some important lessons, as well," the statement read. "We have to continue sharing our stories so that more Houstonians know what HERO is really about and aren't susceptible to the ugliest of smear campaigns run by the opposition."

The Texas Tribune thanks its sponsors. Become one.

Houston Mayor Annise Parker, whose 2009 election made her the first openly gay mayor of a major U.S. city, had warned before the vote that repealing the ordinance would be detrimental to Houston’s reputation as "a warm welcoming place that tolerates differences and respects diversity.”

“Unfortunately, I fear that this will have stained Houston’s reputation as a tolerant, welcoming, global city,” Parker said after the vote. “And I absolutely fear that there will be a direct economic backlash as a result of this.”

With the Houston vote garnering national attention, the loss for HERO supporters comes after a tumultuous year and half since the ordinance was first passed by the Houston City Council in May 2014.

Almost immediately, conservative activists and pastors began collecting signatures to petition a referendum or repeal of the ordinance. City officials later ruled that they hadn’t collected enough signatures, prompting a lawsuit from the opponents.

The ordinance had been in effect for about three months when it was put on hold as the legal challenge made its way through the courts. In April, a state district judge ruled in favor of the city, saying opponents of the ordinance had not gathered enough valid signatures.

The case went to the Texas Supreme Court, which in July told the city council it had to consider a valid referendum petition and repeal the ordinance or put it up for public vote.

As the first big LGBT fight since the U.S. Supreme Court legalized same-sex marriage in June, the Houston vote could prove to be a referendum on the Texas gay rights movement, which has pivoted to discrimination protections since the Supreme Court win.

HERO’s defeat on Tuesday makes Houston, the nation’s fourth-largest city, one of the largest metros without an ordinance banning discrimination on the basis of sexual orientation and gender identity.

The Texas Tribune thanks its sponsors. Become one.

Texas is one of 28 states without statewide laws prohibiting discrimination based on sexual orientation and gender identity. Democrats’ inability to pass a statewide nondiscrimination measure out of the Republican-controlled Legislature has left the state with a patchwork of protections.

Including the Houston council’s 2014 vote on HERO, nine Texas cities with populations of more than 100,000 had passed nondiscrimination rules or legislation.

For at least a decade, Fort Worth, Dallas and Austin have counted among cities with ordinances offering LGBT residents some degree of protection against discrimination in employment, housing and other public areas such as buses and restaurants. San Antonio and Plano joined that list in 2014.

At a watch party for the Campaign for Houston, which opposed the ordinance, Pastor Ed Young of Houston’s Second Baptist Church described the vote against HERO as a “moral issue” and not a vote on discrimination.

“Everybody’s interpreted this as a political thing, and that’s not the perspective from which I come,” Young said. “This is beyond politics. Someone asked earlier if Houston would be perceived by the national press, and other cities, as a place that discriminates. You know this great city. That’s not who we are."

Jordan Rudner contributed to this report.