State Sen. Stanley Rosenberg, for decades one of the most powerful Democrats in Massachusetts, announced Thursday that he will resign Friday after 31 years as a lawmaker because of a scandal involving his estranged husband.

His decision follows Wednesday’s release of an ethics report that states Rosenberg “failed to protect the Senate” from his estranged husband, who faces charges of racially and sexually harassing Senate employees.

“In light … of the disciplinary measure recommended by the ethics committee, it would not be fair to my constituents to have a representative in the Senate who lacked the authority to represent their interests fully,” Rosenberg said in a letter to the Senate clerk, the Boston Herald reported.

Rosenberg, 68, of Amherst, a former president of the Massachusetts Senate, was the first openly gay lawmaker to lead a legislative chamber in the Bay State, Boston’s Fox 25 reported.

He stepped down as president in December, after the Boston Globe reported in November that four men alleged that Rosenberg’s husband, Byron Hefner, had sexually assaulted and harassed them, and boasted of his influence in the Senate.

Hefner was indicted in March. Rosenberg claims to have been unaware of Hefner’s alleged crimes.

Rosenberg’s resignation will take effect at 5 p.m. Friday, State House News Service reported.

Following the release of the ethics report, both Republican Gov. Charlie Baker and Democratic Attorney General Maura Healey called for Rosenberg to resign, Fox 25 reported.

According to the station, the report was prepared by independent investigators hired by the Senate Ethics Committee. It said that while Rosenberg did not violate any formal Senate rules, he showed poor judgment and violated the Senate's information technology policies by granting Hefner “unfettered access” to Rosenberg's Senate email account.

That access began before Rosenberg became Senate president in 2015 and ended in March 2017, after staffers detected two instances of Hefner allegedly sending emails to public officials under Rosenberg’s name.

Rosenberg "knew or should have known Hefner had racially and sexually harassed Senate employees" and failed to address the issue adequately, the report said.

Hefner, 30, pleaded not guilty in Suffolk Superior Court in April to charges of sexual assault, criminal lewdness and distributing nude photos without consent. He was released on his own recognizance pending further court action.