BOSTON (AP) — A Massachusetts bill providing nearly $18 million in pay raises for top lawmakers, statewide elected officials and judges became law Thursday after the Democratic-controlled Legislature overturned a veto by Republican Gov. Charlie Baker.

The Senate voted 31-9 after an earlier 116-43 vote in the House, both above the two-thirds threshold needed to override a veto by Baker, who along with other critics had said the raises were inappropriate at a time when the state’s fiscal outlook remained cloudy.

‘‘Raises of any type are always the subject of disagreement,’’ House Speaker Robert DeLeo told reporters minutes before the override vote. ‘‘I don’t think there is ever a right time or a right place.’’


The measure would immediately increase the salaries of constitutional officers including the governor and boost pay for judges by $25,000.

Not all members of the Legislature will receive raises under the new law, as an earlier constitutional amendment ties the base pay for lawmakers — currently $62,547 — to biennial changes in the state’s median household income. But the new law calls for substantial increases in additional compensation that is paid to House and Senate leaders and chairmen of legislative committees.

The annual stipends paid to DeLeo and Democratic Senate President Stan Rosenberg would increase from $35,000 to $80,000, bringing their aggregate salaries to $142,547. Those stipends were last increased in 1982.

A handful of Democrats joined the Legislature’s heavily outnumbered Republicans in voting to sustain Baker’s veto. Rep. Jonathan Hecht, a Watertown Democrat, complained the new pay structure widens the gulf between rank-and-file lawmakers and Beacon Hill power brokers.

‘‘I have serious concerns that this bill will make the House more unequal, more hierarchical and less representative, said Hecht.

Baker said he would not accept the salary increase from $151,800 to $185,000, along with a new $65,000 housing allowance provided to the governor. Lt. Gov. Karyn Polito also planned to decline a raise to $165,000, Baker said.

‘‘Authorizing this drastic salary increase with limited debate defies this obligation and places an undue financial burden on the people of Massachusetts,’’ Baker said in a statement following the Senate vote.


Under the new law, Democratic Attorney General Maura Healey and Democratic state Treasurer Deb Goldberg would see their pay increase to $175,000.

A spokeswoman for Healey said she was ‘‘opposed to this increase when it was first proposed two years ago, and will not accept the increase for the remainder of her term.’’

An aide to Goldberg said she will not be taking the raise.

State Auditor Suzanne Bump, a Democrat, said she would accept a hike to $165,000.

Massachusetts is hardly the only state wrestling with contentious issues surrounding compensation for public officials.

In November, a special commission charged with reviewing whether the $79,500-a-year salary for New York state lawmakers should be increased for the first time since 1999 rejected a pay hike that Democratic Assembly Speaker Carl Heastie called ‘‘long overdue.’’

Legislative pay has been stagnant in most U.S. states in recent years. Several have moved to freeze the pay of lawmakers and other elected officials. Others have decided to remove politics from the process altogether.

In Minnesota, where lawmakers haven’t had a raise since 1999, voters passed a constitutional amendment handing off authority over legislative pay to an independent commission.

Base pay for Massachusetts lawmakers was the seventh highest in the nation in 2016, according to a survey by the National Conference of State Legislatures.

__

Associated Press writers Steve LeBlanc in Boston, David Klepper in Albany, New York and Kyle Potter in St. Paul, Minnesota contributed to this report