Republican Governor Charlie Baker on Friday signed a bill into law that broadens Massachusetts laws banning discrimination in public accommodations to include gender identity.

Baker signed the bill a day after the Democrat-controlled House and Senate approved a final version of the legislation.

When the law takes effect on October 1, Massachusetts will become the 18th state to ensure full protections for transgender people.

No one should be discriminated against in Massachusetts because of their gender identity,” Baker said on Friday.

Baker had previously said that he would sign the House version of the bill, which included language that sought to address some privacy concerns, including requiring the creation of guidelines for business to follow and instructing the state's attorney general to advise law enforcement on how to deal with people who assert gender identity for “an improper purpose.” Most of that language made it into the final legislation.

This compromise legislation extends additional protections to the commonwealth's transgender community, and includes language to address the public safety concerns expressed by some by requiring the attorney general to issue regulations to protect against people abusing the law,” Baker added.

LGBT rights advocates had sought such protections in Massachusetts for nearly a decade.