BOSTON (STATE HOUSE NEWS SERVICE) – Hours after formally receiving their plan, Gov. Charlie Baker on Thursday afternoon informed legislative Democrats that he intends to veto a controversial package of pay raises worth $18 million for lawmakers, judges and constitutional officers in a move that may carry more political weight for the Republican governor than practical implications.

With veto-proof majorities in both branches backing the bill (H 58), the pay raises are all but assured to go through. But with conservative groups and even one possible Democratic challenger for governor in 2018 – Newton Mayor Setti Warren – urging a veto, Baker’s stance against the raises may be enough to shield him from the political blowback without damaging his relationships with Democrats who run the Legislature.

“Lt. Governor Polito and I are deeply thankful for our collaborative relationship with the Legislature that has produced positive results for the people of Massachusetts – and while we disagree on the issue of compensation, we are optimistic that we will continue to work together to carry out the responsibilities entrusted to us by the people of Massachusetts,” Baker said in a statement early Thursday night. “One of those core responsibilities is the responsible custody of the people’s tax dollars, and we will veto this legislation because given the current fiscal outlook for the state, now is not the time to expend additional funds on elected officials’ salaries.”

A senior advisor to Baker said he will veto the bill Friday, returning it the House where they can begin to prepare for an override vote. It’s not clear yet how much pressure, if any, the governor will apply to lawmakers in a bid to switch votes and earn enough support to sustain his veto – overrides require two thirds support in both branches to take effect.

Despite threatening to veto legislative pay raises in the fall of 2014 when he was still governor-elect, Baker gave legislative leaders wide berth after they surfaced the idea of pay raises last week and then rammed their expansive bill through this week.

In the span of two days, House Speaker Robert DeLeo and Senate President Stanley Rosenberg mustered veto-proof majorities in both branches for the $18 million suite of pay raises that include $45,000 raises for the Legislature’s top two Democrats bringing their salaries to over $142,000. In addition to $2.8 million in salary and office expense increases for itself, the Legislature voted for $25,000 raises for judges and hikes in the pay for all six constitutional officers, including the governor.

Acting less than 24 hours after the House on Thursday, the Senate voted 31-9 in support of the pay raises after very little debate and the branches took the final procedural votes needed to get the bill to the governor.

The House enacted the pay raises on a 116-43 vote, and the Senate passed its proposal (S 16) with three Democrats joining all six Republican senators in opposition. The Democrats voting against the bill were Sens. Anne Gobi, Michael Moore and Walter Timilty.

Assuming the votes hold, opponents would need to switch 10 additional Democrat votes in the House and five in the Senate to sustain Baker’s veto. All 41 Republicans in the House and Senate voted against the bill.

Even if the pay raises become law, Baker has said he and Lt. Gov. Karyn Polito would decline the increases in their own pay, including the proposed $65,000 housing allowance for the governor that would added to his new $185,000 salary. The raises and the new housing allowance, should they survive, would be available for Baker’s eventual successor and future governors.

Through spokespeople, Attorney General Maura Healey declined to comment on whether she would accept the raise and Treasurer Deborah Goldberg said she would decide if it became law, while Auditor Suzanne Bump said she would accept the pay hike. The auditor’s salary will increase from roughly $140,000 to $165,000.

A spokesman for Secretary of State William Galvin did not respond to a request for comment.

Timilty, a former House member whose first vote in the Senate came on the issue of raises, declined to comment on his vote when approached outside the chamber Thursday.

Gobi, a Spencer Democrat, called her decision to oppose the measure a “conscientious vote.”

“I just thought it was too much considering the situation many of the people in the commonwealth are going through,” Gobi told the News Service.

She was also carrying a copy of the letter she intends to send to Treasurer Goldberg declining the pay increase should it become law, and said she hoped her colleagues who also voted no would similarly not accept the raise.

“You can’t be hypocritical. If you vote no, you shouldn’t take the dough, so I won’t take the money,” Gobi said.

Legislative leaders worked behind the scenes over the winter on the pay raise bill before springing the topic into the public realm last Tuesday by calling for a hearing on Thursday on a two-year-old report on pay levels for public officials. Lawmakers on Monday night unveiled their bill. With the potential for larger paychecks on the horizon, the branches whisked the legislation through.

While base pay rates of legislators are adjusted every two years based on changes in median income, Senate Ways and Means Chairwoman Karen Spilka defended the pay raises on the floor, arguing that stipends for leadership and senior committee positions had not been adjusted since either 1982 or 1994.

Spilka, of Ashland, promised that the $4.1 million cost of the raises over the final six months of this fiscal year would not require a special budget bill to appropriate more money for salaries, but rather would be absorbed into existing budget.

The only amendment proposing a change to the bill that wasn’t withdrawn before debate began was a Sen. Donald Humason plan proposing to delay the raises until January 2019 after the next election cycle. Humason said postponing the pay raises would be in keeping with how Congress and many city council’s deal with compensation changes for elected officials.

The amendment was rejected on a voice vote.

Newton Mayor Warren, a Democrat who is exploring a possible run for governor in 2018, took on leaders of his own party after the vote and urged Baker to veto the bill, calling it a “poorly rushed-through pay raise plan” that should have been subjected to more debate and transparency.

“Beacon Hill should be focused on putting together a balanced budget without the using even one dollar of one-time revenues, not this. Until Beacon Hill prioritizes issues like the crushing debt too many students need to assume to earn a college degree, no pay increase for elected leaders should be considered,” Warren said in a statement. “I’m strongly opposed to the pay raise process that is occurring and urge Beacon Hill to stop, focus their time and energy on higher priorities and put this proposal on a more transparent path.”

Legislative leaders did not hold a public hearing on the proposal.

Paul Craney, executive director of the Massachusetts Fiscal Alliance, also chided lawmakers, who consider themselves part of a full-time working Legislature even though activity in the House and Senate can be sporadic, with busy spells sometimes followed by long lulls.

“Being a member of the Massachusetts Legislature is now the best part time job in America,” Craney wrote to the News Service.