Massachusetts Republicans just lost their popular governor. They’re not all mad about it.

Erin Clark/The Boston Globe via AP

BOSTON — Massachusetts Republicans are teetering on the brink of electoral extinction without Gov. Charlie Baker.

But the popular governor’s exit provides a crucial break in a yearslong power struggle that’s paralyzed the state GOP just as the party prepares to pick a new leader, giving Republicans in this deep-blue state the chance to realign and rebuild — if they choose to take it.

The GOP has been propped up for decades in liberal Massachusetts by a succession of fiscally conservative and socially moderate Republican governors who’ve won elections by appealing across party lines. But Donald Trump’s rise splintered the GOP and imperiled its electoral prospects.

When Baker leaves office Thursday, he’ll be replaced by a Democrat — Maura Healey, the state attorney general who beat a Trump-endorsed Republican nominee, Geoff Diehl, by nearly 30 points. Lt. Gov. Karyn Polito, once Baker’s heir apparent, is exiting too, leaving Republicans holding no statewide or federal elected offices. The party’s share of the state’s registered voters has dipped below 9 percent and its legislative minority shrank — again.

Still,Baker cautions against issuing an obituary for the state GOP, saying the party has overcome leadership vacuums in the past.

“Democracies don’t really like one-party rule for a lot of reasons,” Baker, who chose not to seek a third term, said in an interview. “I think it’s unwise to write [the party off].”

But first, Republicans have to stop sabotaging themselves. Baker’s long-running feud with state GOP Chair Jim Lyons, an uncompromising pro- Trump conservative who’s helmed the party since 2019, left Republicans so strapped for cash and so hobbled by infighting they barely conduct business at state committee meetings, let alone win elections.

The Democratic takeover on Beacon Hill could reunite Republicans against a common enemy. And that, combined with the party’s leadership election at the end of January, could offer the reset Republicans on both sides of the intraparty divide crave.

“I do see an enormous opportunity without having a governor, I really do,” Jennifer Nassour, a Baker ally who served as chair of the state GOP during Democratic Gov. Deval Patrick’s tenure, said in an interview. “When you don’t have a governor, you get to build your own thing.”

The recalibrating of the Massachusetts GOP offers one of the first glimpses into how the party’s post-midterm reckoning is playing out at the state level — and how complicated it can be.

The Bay State’s Republican rift doesn’t break cleanly along ideological lines. Nor can it be categorized solely as a split between those who have supported Trump, like Lyons, and those who don’t, like Baker.

Disagreements about the party’s direction post-Trump run rampant. But its fissures are also fueled by deeply personal gripes and legal battles over its finances.

Lyons has sought a federal investigation into the party’s spending under Baker allies and sued those who he claims are trying to sabotage him. He led a campaign to oust one of his enemies, Ron Kaufman, as the Republican National Committee’s treasurer before Kaufman, Massachusetts’ national committeeman, decided not to seek another term.

Those frustrated with Lyons’ leadership have walked out of state committee meetings to deny him the quorum he needs to pass a budget — to which Lyons responded by suing the party treasurer for blocking access to its bank account. Howie Carr, the state’s most prominent conservative radio host and columnist, has turned against him.

Baker has called on Lyons to step aside for more than a year. Lyons has told the moderate Republican, who alienated a faction of his party through his dealmaking with the Democratic-controlled Legislature and his disdain for Trump, to “reconsider his party affiliation.”

The infighting culminated in Republicans effectively running two slates of candidates in last year’s election.

Both largely lost. And each side is blaming the other.

Lyons’ supporters slam Baker and his allies for refusing to back Diehl while campaigning heavily for a more like-minded Republican for auditor. They say Baker hasn’t done enough to build the party’s bench and bristle at a super PAC funded by his donors that supports centrist Democrats as well as Republicans.

“I understand [Diehl] wasn’t going to win that election. But there was a time when we all supported our nominee because that was the will of the party,” Todd Taylor, a Lyons ally on the state committee and a Chelsea city councilor who lost his campaign for state representative last fall, said in an interview. “We can’t have people sabotaging from within.”

Baker’s supporters criticize Lyons for leading the party in a hard-right and Trumpian direction that’s proved unsellable in solidly blue Massachusetts — where Trump has suffered some of his worst general-election losses — and for alienating donors in the process. They also balk at his use of the party’s limited resources to fund his various lawsuits.

In an interview last week in his ceremonial office at the State House, Baker said it’s “important to kind of take stock of where the party is and what happened and what to do about it.”

But Baker, who’s shifting his focus to his next job as president of the NCAA, isn’t offering solutions for how to fix the state GOP. He wants the party chair to be “somebody who wants to win elections.” But said he isn’t planning on endorsing anyone for the job.

“Parties are supposed to win elections, and thereby making it possible to govern and to hold the other party accountable,” Baker said. “We’ll see what happens.”

Before they can win elections, major players on both sides of the intraparty feud say the next party chair will have to first reunite its moderate and hard-right factions.

Lyons still hasn’t officially said he’s running for a third term as chair, though he’s widely expected to. He’ll face more moderate rivals — his vice chair, Jay Fleitman; state committee member Amy Carnevale; former Republican town committee chair Jon Fetherston and consultant Christopher Lyon — who are sounding alarms about the party’s future if it can’t again appeal across party lines.

Carnevale, a Baker-Trump voter who lost her bid to represent the state on the RNC, is considered to be Lyons’ main competition and, therefore, a new target in his legal battles. She’s amassed a coalition of big-name Republicans who she says are willing to work with her to recruit candidates and bring back donors who’ve ditched the party under Lyons, including former Bristol County Sheriff Tom Hodgson, former GOP U.S. Senate candidate Beth Lindstrom and Polito, the outgoing lieutenant governor.

Yet even as she touts her support among Baker world, Carnevale said she’s not seeking his endorsement for party chair.

“Governor Baker’s not in office anymore. And to focus on him or the people who supported him is not helping our party and our candidates,” she said in an interview. “We need to just move forward and start a new chapter. We need to switch the dynamics in how we think about the party.”

Amanda Orlando, Diehl’s campaign manager and a state committee member allied with Lyons, is also hoping for a post-Baker reset that includes more outreach to independents who make up more than 60 percent of the state’s voters. But to her, that means letting Lyons lead “without the constant interference” from his detractors.

“Democrats will get behind a candidate. They don’t stay home. They don’t get angry and take their toys out of the sandbox. They accept a primary happens and somebody has won and that’s who they get behind,” Orlando said. “Unfortunately, we don’t.”