The measure would update state anti-discrimination law. So, just as a restaurant or theater can’t refuse service to people based on their race, such venues couldn’t discriminate against transgender people.

After an emotional debate, the Massachusetts state Senate on Thursday passed a controversial bill that would prohibit discrimination against transgender people in sports arenas, gas stations, movie theaters, bars, malls, and other public accommodations.

The legislation, which now heads to the House, is aimed at protecting people who identify with a sex other than the one they were assigned at birth. It would specifically allow people to use the restrooms, locker rooms, and changing rooms that match their gender identity.


That’s prompted fears from opponents who claim that male sexual predators, under the guise of being transgender, could enter women’s restrooms and locker rooms. Proponents of the bill say those worries are unfounded.

“We’re disappointed that the Senate has eliminated commonsense protections for women and children in public locker rooms, bathrooms, and changing facilities,” said Andrew Beckwith, President of the Massachusetts Family Institute.

But most senators framed the vote as historic and one ensuring civil rights.

“This about making sure that absolutely everyone in each of the 351 cities and towns that we represent — that we can look into each of their eyes and say that you will not be denied the ability to participate fully in your community because of who you are,” said Senator Benjamin B. Downing, Democrat of Pittsfield.

Parents of transgender children are looking “for their kids to be whomever they happen to be, to be loved for whoever they are, and to be given the freedom to be who they are as individuals and to live successful and happy lives. And that’s what this boils down to,” said Senator Richard J. Ross of Wrentham, the only Republican to vote in favor of the measure.


John F. Keenan, a conservative Democrat from Quincy, voted in favor of the bill. He said he doesn’t think “anybody, anytime, anywhere should be discriminated against for living a life that they were meant to live. And that’s what this vote is all about today.”

The Democratic leaders of the Legislature, Senate President Stanley C. Rosenberg and House Speaker Robert A. DeLeo, both back the bill. Governor Charlie Baker, a Republican who opposed such a measure during his failed 2010 run for governor, has not taken a position on it. Still, Baker has indicated he probably won’t veto it should the legislation be sent to his desk.

While DeLeo, the House speaker, supports the thrust of the legislation, but the House is likely to take up a different version than the one passed by the Senate. That vote is likely to happen in coming weeks.

Opponents frame it as a threat to the safety of women and children.

Advocates say the bill is long overdue. They say 18 states and more than 200 cities across the country already protect transgender people from discrimination in public accommodations.

Joshua Miller can be reached at joshua.miller@globe.com. Sign up for his weekday newsletter on politics at bostonglobe.com/politicalhappyhour