Advocates for increased oversight of Massachusetts police welcomed passage of compromise legislation Tuesday that would empower a majority-civilian review board that would have the power to remove officers from service if they were found guilty of wrongdoing or abusing their authority.

"Many tens of thousands of people marched in Massachusetts in so many demonstrations, as they did around the country, asking them to address these issues and this does address not all, but at least some, of those issues," activist Lew Finfer said of the 129-page bill passed by the House and Senate.

"Don't think that this comes from the benevolence of government," community organizer and writer Jamarhl Crawford told GBH News.

Crawford, a member of Mayor Marty Walsh's Boston police reform task force, continued: "This came from decades of push from the grassroots and community folks, myself among them, who have pushed and prodded these people and informed these people on these issues for decades."

The final bill, the result of months of secret negotiations between House and Senate leaders, was approved by both branches of the Legislature Tuesday night by closer margins than Beacon Hill usually sees.

The 92-to-67 vote is one of the narrowest margins for a major bill in Speaker Robert DeLeo's 11 years at the helm of the House, failing to secure the two-thirds majority needed to override Gov. Charlie Baker's amendments.

Conservatives like Brewster Rep. Tim Whelan voted 'no' because progressives added bans on facial recognition technology and some police procedures not directly connected to police oversight.

"That was introduced by the special interests who took control, took control of a very good thing that we did and that we had going on. It became a wish list to the detriment of our process," Whelan said on the House floor.

Police unions had fought to lobby negotiators to step back on provisions that would ban the use of certain types force by police and curtail protections officers have from civil lawsuits. In a letter to members, leaders of the Massachusetts Coalition of Police described the Legislature's work, which began in July, as a "grossly unfair and opaque" process that "played out in secret."

The letter criticized the keystone of the new reform effort, a nine-member oversight panel that would be empowered to investigate complaints of wrongdoing by police and to decertify an officer, effectively ending their policing career.

"The final compromise legislation is a final attack on police officers by lawmakers on Beacon Hill," they wrote and urged Gov. Charlie Baker to reject the legislation.

"We are concerned with the limited visible process, the unknown and extensive costs of this legislation, the minimal representation on the boards and commissions from the professions they oversee, and the lack of study of the consequences for public safety — both intended and unintended," the State Police Association wrote in a press statement.

The Boston Police Patrolmen's Association did not respond to GBH News' requests for comment.

The bill is now on Baker's desk, giving him 10 days to review it before signing it, vetoing it, or offering changes.

Baker approves of much of the bill, but could side with the House GOP and police unions that want to remove limits on police legal protections and bans on some police tactics.

Baker said Tuesday that his office has yet to finish its review of the legislation.

"I'm glad that the legislature moved forward on this. I'm glad this is something that was part of what they consider to be important to get done before the end of the session. But I can't speak to the specifics of this until we have a chance to review it," Baker said.

Police reform activists were generally pleased with the final outcome.

"It's really a huge step, an historic step, towards justice in the Commonwealth," ACLU Massachusetts president Carol Rose said Tuesday on GBH News's Boston Public Radio.

"This really reflects a lot of compromise, including some compromises from civil rights groups, but I think it's really a step forward," Rose said.

Crawford, on the other hand, was skeptical that the new law would have the impact supporters are looking for.

"There's no indication that decertification is going to improve police performance or community relations," he said. "It just creates a mechanism by which these people can be held accountable."