A man leaves the headquarters of Uber in San Francisco in this file photo. (Eric Risberg/AP)

Deep inside complex legislation to legalize phone-based car services such as Uber and Lyft sat language meant to prohibit drivers from discriminating against gay or transgender riders.

The wording, picked up from legislation proposed in states where gay rights are enshrined in state code, went unnoticed until the bill made it to the Senate floor. Once the passage was discovered, the bill was abruptly sent back to committee for what was described as a “technical” fix, stripped of that language and returned to the chamber, where it passed this week.

The matter was handled so quietly that activists on both sides of the gay-rights issue were in the dark until after the wording had been nixed — a change that took place at a quickie meeting of the Transportation Committee on the Senate floor, with members huddled around the desk of the panel’s chairman, Stephen D. Newman (R-Lynchburg).

The episode disappointed gay-rights activists and alarmed conservatives in a state where court rulings legalized gay marriage last year but where the state constitution still bans it. The Republican-controlled legislature has continued this year to kill bills to recognize gay marriage and other gay rights in state code.

The Family Foundation of Virginia feared that the language in the transportation bill was a stealthy attempt to “promote the sexual orientation/gender identity agenda,” the group’s president, Victoria Cobb, wrote in an e-mail to supporters this week.

“It isn’t only in obvious ways that sexual orientation/gender identity is being introduced,” she wrote. “SB 1025 is a bill that would require companies like Uber to be licensed by the DMV. A new version of the bill was introduced in committee that included special protections for sexual behavior, but no one was told it was drafted into the bill until after it made it out of committee.”

In an interview, Cobb said her group would redouble its efforts to monitor legislation, even bills that seem to have nothing to do with social issues.

“A policy this significant should be reviewed on its own, not buried in another [issue],” she said. “Certainly we will be vigilant about watching for something like this being attempted in future bills.”

The original language would have prohibited car service companies and their drivers from discriminating against “passengers or potential passengers on the basis of points of departure and destination, race, color, national origin, religious belief or affiliation, sex, disability, age, sexual orientation, or gender identity.” As amended, it requires car services to “comply with all applicable laws regarding nondiscrimination” — which, in Virginia, does not cover gay or transgender people.

James Parrish, executive director of Equality Virginia, saw the episode as a missed opportunity.

“We believe strongly that lesbian, gay, bisexual and transgender people should not be discriminated against when it comes to public accommodations, including — but not limited to — transportation network companies,” he said. “While we support any bill language that would make it illegal for any industry to discriminate against people because of their sexual orientation or gender identity, what is really needed in the commonwealth is a law to ensure all public accommodations, including restaurants, bars, stores, parks, hotels, libraries and transportation services, cannot deny goods or services to people just because of who they are.”

Newman and other members of the committee said no one sneaked the gay-rights language into the bill. That wording was inadvertently picked up when the legislation was cobbled together from similar bills proposed in other states, he said. A committee staff member noticed the language and brought it to lawmakers’ attention.

“Nobody’s pointing a finger at each other or accusing anybody of being sneaky,” said Sen. Mark D. Obenshain (R-Harrisonburg), who co-sponsored the bill with Sen. David W. Marsden (D-Fairfax). “My name is on the bill. I didn’t mean for [the clause] to be there. . . . Dave, I don’t think, meant for it to be there. It’s just one of those things that we will wind up, through the legislative process, figuring it all out.”

Marsden said he understood the rationale for the language.

“Suppose you’re an Uber driver and you pull up to what’s known as a gay bar and you go, ‘Oh, no, no, no, no.’ I drive off. You’re trying to prevent that.”

But Marsden said he concluded that it would have been unfair to impose a higher nondiscrimination standard on car services than on other businesses that operate in Virginia, even though he would like to see state law changed to outlaw discrimination against gay or transgender people.

“I’d rather see it in the code, but if it’s not in the code now, it’s unfair to put it against them,” he said.