HOUSTON — The predominantly black 3rd Ward here, a historic and struggling community, seemed like the kind of precinct that would be sympathetic to a broad ordinance outlawing discrimination based on factors such as race, religion and sexual orientation.
But at a polling site in the Cuney Homes public housing complex here Tuesday, the talk among voters was not about discrimination. Picking up on an ad campaign run by a coalition of pastors, social conservatives and Republicans opposed to the measure, they voiced concerns as parents that it would let men claiming to be women enter women's bathrooms and attack.
"I got three daughters," said Todd Ward, a city worker who voted against the ordinance. "You have too much child molestation going on. It's equal rights, but there's not an equal right for me to go into a women's bathroom. That's common sense."
More than a year ago, when Mayor Annise D. Parker and her supporters first proposed the ordinance and steered it through the City Council, they expected it to be welcomed in a diverse city that had become, with Parker's election in 2009, the nation's first big city to elect an openly gay or lesbian mayor.
Instead, voters called for the ordinance's repeal Tuesday, a blow to gay and transgender rights advocates, and perhaps the most significant victory for social conservatives since they were rocked by the Supreme Court ruling in June establishing a constitutional right to same-sex marriage. Voters rejected the ordinance overwhelmingly, 61 percent to 39 percent.
The political and economic consequences for Houston were unclear Wednesday as rights groups said their battle for a nondiscrimination measure, similar to those passed in 200 other cities, was far from over.
"We lost a battle, but we will never stop fighting for equality for all," Gilberto Hinojosa, the chairman of the Texas Democratic Party, said in a statement.
Supporters of HERO — their shorthand for Houston's Equal Rights Ordinance — called for the city's next mayor to try to pass the measure again after Parker's third and final term ends this year. And a national gay rights leader on Wednesday called for an "emergency meeting" with the National Football League's commissioner, Roger Goodell, to discuss Houston's role as host of the Super Bowl in 2017.
"Commissioner Goodell, you have emphasized the N.F.L.'s commitment to diversity and inclusion, respect and fairness," Chad Griffin, the president of the Human Rights Campaign, wrote in a letter. "If the Super Bowl is to remain in Houston, these protections need to be in place to ensure the safety and well-being of all those participating."
Still, what was clear was that a monthslong effort by social conservatives to repeal the ordinance and reframe the issue had paid off, through tactics likely to be used again in similar battles around the country.
Through speeches, yard signs, T-shirts, banners and ads on TV, the radio and the Internet, they zeroed in on the measure's gender-identity protections and focused the debate on a narrow issue whose very relevance was disputed by political rivals: bathrooms, and access to them.
This reframing cast the issue as a matter of public safety, with claims that the measure would allow men who were dressed as women or who identified as women to enter women's bathrooms and attack or threaten girls and women inside. The measure's critics called it the Bathroom Ordinance and simplified their message to five words: "No Men in Women's Bathrooms."
Jared Woodfill, a spokesman for the main coalition against the ordinance, the Campaign for Houston, said that the focus on bathrooms had emerged from strategic deliberations more than a year ago, and that the coalition had tested its effectiveness through polls. "When we polled it, it was clearly a message that resonated," said Woodfill, a former chairman of the Harris County Republican Party.
Tony Perkins, the president of the Family Research Council, based in Washington, and one of the few national Christian conservative figures involved in the Houston battle, said the victory had thrilled religious conservatives, "This actually looks hopeful for those who want to preserve traditional morality in our country," Perkins said.
The ordinance was approved by the City Council last May but was not put into effect after its opponents gathered signatures to put the measure on the ballot and won a court battle to move ahead with the referendum.
The measure banned discrimination in housing, private employment, city contracting and businesses such as restaurants, bars and hotels for 15 protected classes. These included minorities, women, gays and transgender individuals. Restrooms are not specifically mentioned in the measure, which is why conservatives were accused of fearmongering. Still, it was the ordinance's supporters, not its opponents, who appeared to first raise the issue of bathrooms last year. A draft of the bill, included a section that was later removed, that would have allowed transgender people to use the bathroom that best reflected their gender identity. Opponents seized on the issue and never let go.
Weeks before Election Day, the Campaign for Houston aired a TV ad that showed a man stepping into a woman's restroom and hiding in a stall. Then a girl wearing a school backpack walks in. The ad, shot in black and white, ends with the man entering the girl's stall and shutting the door. It was one of several ads they released, but "the one we ran the most," Woodfill added.
The largely local conservative coalition included Ed Young, the ex-president of the Southern Baptist Convention and the pastor of one of the city's biggest churches, and Lt. Gov. Dan Patrick, a Republican and longtime critic of Parker, a Democrat.
A little-known Republican political consultant in Austin, Jeff Norwood, wrote the bathroom TV ad. At a victory party at a Houston hotel, he shook nearly as many hands as Patrick on Tuesday night.
"We just wanted to let people understand what the stakes were in this campaign," said Norwood, a former elected official in West Texas. "It framed the debate in a way that the other side could never get away from."
They held rallies and meetings at churches. The Campaign for Houston raised less money than its rivals — more than $1 million versus nearly $3 million — and had fewer contributions flowing in from out of state. "We don't have folks from D.C. sending us big checks," Woodfill said.
One of their biggest local checks was rescinded. Less than two weeks before Election Day, Robert C. McNair, the owner of the Houston Texans football team, asked the Campaign for Houston to return his $10,000 personal contribution. In a statement, he said the group had "made numerous unauthorized statements" about his opposition to the ordinance.
In her speech to supporters Tuesday night, Parker remained defiant, vowing to continue the fight. "This was a campaign of fearmongering and deliberate lies," she said. She also suggested that Houston's vote could bring consequences.
"I fear that this will stain Houston's reputation as a tolerant, welcoming global city," Parker said. "And I absolutely fear that there will be a direct economic backlash."
The NCAA said Wednesday it would not abandon its plan to hold the Final Four portion of its college basketball tournament in Houston next year. Dan Gavitt, the organization's vice president of men's basketball championships, said in a statement that "it takes years to plan and implement this world-class event."
But he also said the city's vote "could impact the NCAA returning to Houston for a future Final Four."
Despite the requested meeting by the Human Rights Campaign, Brian McCarthy, an NFL spokesman, said Wednesday that the vote would "not affect our plans for Super Bowl LI in 2017."