After a decade of emotional and divisive debate, Massachusetts House and Senate leaders came to final agreement on a transgender rights bill Wednesday and are likely to send it to Governor Charlie Baker by the end of the week.
The bill would allow people to use the restrooms, locker rooms, and changing rooms that match their gender identity, and would protect transgender people from discrimination in museums, malls, libraries, restaurants, and other public accommodations.
Baker has said he believes no one should be discriminated against based on their gender identity and backed an earlier iteration of the bill. But on Wednesday, a spokeswoman stopped short of saying if he would sign the compromise bill into law.
Communications director Lizzy Guyton said Baker “looks forward to carefully reviewing the final bill.”
Similar legislation has been filed but has failed to make its way through the legislative process at least since 2007, with opponents trumpeting public safety concerns. Indeed, in his losing 2010 bid for governor, Baker’s campaign literature said he would veto the “bathroom bill.”
Advocates framed the compromise Wednesday as a significant win.
“This is a huge victory. It’s been a long time in coming. And it’s phenomenally important to the trans community, and phenomenally important to making us a better state, a more fair state,” said Arline Isaacson, a lobbyist and longtime backer of the measure.
But opponents, who have repeatedly expressed worry that male sexual predators, under the guise of being transgender women, could enter women’s restrooms and locker rooms, decried the final legislative language.
“It continues to compromise the privacy and safety of our Commonwealth’s women and children,” said Andrew Beckwith, president of the Massachusetts Family Institute.
Backers of the bill say such fears are unfounded and have not been borne out by the reality of the almost 20 states where transgender public accommodations protections already exist.
Discussion of transgender civil rights has been a big part of the national political debate in recent months, from transgender reality TV star Caitlyn Jenner using the women’s bathroom at Trump Tower in New York to the strong backlash over a law in North Carolina that mandates people use only the bathroom that matches the sex stated on their birth certificates.
The Obama administration recently said public schools must allow transgender students to use the bathrooms and locker rooms that match their gender identity, prompting 11 states to sue.
And a mass shooting at a gay nightclub in Orlando has renewed public discussion about discrimination against lesbian, gay, bisexual, and transgender people in the United States.
Senator Sonia Chang-Díaz, one of the legislators who hashed out the final language, said it’s important to set the bill in a national context, given “the anti-LGBT events that we’ve seen take place in the public sphere across the country.”
The Jamaica Plain Democrat told reporters it is key for Massachusetts to “stand on the right side of history and that public accommodations are fundamental to equal rights.”
The Senate and House had disagreed on when the bill would take effect. The compromise measure would be fully effective Oct. 1, with one antidiscrimination part of the bill — prohibiting advertising or signs that discriminate against transgender people — going into effect immediately, should the Republican governor sign it into law.
The controversial bathroom and locker room provision would take effect in October.
Another area of disagreement was language, included by the House, that would require the attorney general to issue guidance on when and how action can be taken against people who assert gender identity for “an improper purpose.”
It would also mandate that the Massachusetts Commission Against Discrimination make rules to protect transgender people from discrimination.
Those provisions, slightly tweaked, were included in the compromise.
Legislators say the guidance will address several concerns: safety worries from opponents who fear predators using the law for ill; anxiety from businesses wondering how and when they can legally ask a person if there is some question about their gender; and concern from transgender people that they might be unreasonably harassed for proof of their gender identity.
The House and Senate are poised Thursday to enact the measure in up-or-down votes, according to two top State House officials familiar with the legislative schedule.
On Wednesday, each chamber’s leader heaped praise on the compromise language.
“This is a great victory for the transgender community, who asked only that they be given equal protection under the law,” said Senate President Stanley C. Rosenberg.
“I’m proud of this bill that fully reflects Massachusetts’ tradition of tolerance and inclusion,” said House Speaker Robert A. DeLeo.
Former representative Carl M. Sciortino Jr., who filed a bill that included transgender public accommodations protections in 2007, said Wednesday’s news was a sign the transgender community has, in the past decade, “come a long way.”
“This is really a testament to them and their families for telling their stories and being patient with the process,” he said. “I look forward to celebrating with my trans brothers and sisters after the bill is signed into law.”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.