The House of Representatives passed a controversial transgender public accommodations bill Wednesday after hours of heated debate.
The bipartisan vote was 116-36.
Afterward, proponents cheered. Outside the House chamber, opponents, holding images that showed a man peering over a barrier at a woman, shouted “Shame on you!” as legislators walked by.
The bill would allow people to use the restrooms and locker rooms that match their gender identity and would protect transgender people from discrimination in shopping malls, libraries, restaurants, and other public accommodations.
The House version is different than the one passed earlier by the Senate, so the two must be reconciled. Governor Charlie Baker has said he would sign the House version of the bill if it reaches his desk.
During the House debate Wednesday proponents framed the legislation as a great leap forward for civil rights.
“You can’t tell somebody it’s OK to work at the diner, but not OK to sit at the lunch counter. We learned that a long time ago,” said Representative John V. Fernandes, a Milford Democrat who, as a chairman of the Judiciary Committee, helped write the bill.
Representative Benjamin Swan, a Springfield Democrat, said he knows about discrimination as a black person born in Mississippi in 1933.
He told a hushed chamber “some here will attempt today to smooth over some of the hurt and pain that has been inflicted on others by allowing this present practice of discrimination against” transgender people to continue.
But, he said, smoothing pain over isn’t eliminating it. And he wholeheartedly endorsed the bill.
Opponents expressed worry the bill would allow men masquerading as transgender women to enter women’s locker rooms and bathrooms for nefarious purposes.
“This bill before us today is not a bill that would protect rights,” said Representative Marc T. Lombardo, a Republican of Billerica. “This is a bill that would take away rights from more than 99 percent of the population — the basic right to privacy in bathrooms and locker rooms, the rights of our children to feel safe in a bathroom.”
Backers say those concerns are unfounded and not borne out by the reality in the almost 20 states that have such protections for transgender people.
How each legislator voted on the measure:
Joshua Miller can be reached at email@example.com. Follow him on Twitter @jm_bos and subscribe to his weekday e-mail update on politics at bostonglobe.com/politicalhappyhour.