After months of uncertainty and intraparty fighting over spending levels, Republicans in control of the Statehouse celebrated final passage of a two-year state budget on Thursday that Gov. Chris Sununu said he will sign into law.

“We were able to do this as a unified party,” said House Speaker Shawn Jasper, who stood shoulder to shoulder with dozens of smiling GOP lawmakers at a podium outside the governor’s office. “We showed we can govern as Republicans.”

That sentiment had been in doubt in the weeks leading up to the vote, as House conservatives vowed to kill the $11.7 billion spending plan like they had done earlier in the session.

The plan, however, passed the House by a wide margin, with just 14 Republicans out of 221 voting against it.

Though the House Freedom Caucus spent months slamming the budget for spending too much, many members ultimately voted for it. Behind the scenes, Sununu and top Republican leaders had been lobbying hard for the budget, which they say will spur economic growth through tax cuts while addressing crises in mental health and child protection.

“Things we are able to bring to the taxpayers I think in the long run are going to be beneficial to the state and that’s why some of us crossed the line,” said Rep. Victoria Sullivan, a Manchester Republican and member of the Freedom Caucus.

Notably absent from celebrations in the Executive Council Chambers, where members whooped and whistled as Sununu shook hands, were Democrats, who almost unanimously opposed the budget. They argued it short-changed critical social services for the sake of tax cuts that benefit “out-of-state businesses.”

“This budget spends more on business tax cuts than on combating the opioid epidemic,” said Sen. Dan Feltes, a D-Concord.

All Senate Democrats voted against the budget and the plan won support from only five House Democrats, who Jasper praised for their “courage” crossing party lines.

Sununu called the spending plan, his first since taking office in January, a “big win.” It includes many of the spending priorities he had sought, including a $10 million student scholarship program and an infrastructure fund to help public schools get fiber optic and safety upgrades.

Republicans touted the plan for not raising taxes or fees, while cutting business taxes, eliminating the electricity consumption tax and authorizing mobile scratch tickets that are expected to raise $13 million in new revenue.

The budget will add 60 new mental health treatment beds meant to alleviate the number of psychiatric patients who often wait days or weeks in emergency departments for space to open up at New Hampshire Hospital.

Senate Finance Chairman Gary Daniels said to lawmakers the plan invests heavily in health and human services.

“To my friends on the Democrat side: this was one of your top priorities,” he said.

Democrats, however, said the budget lacks adequate money to address the opioid crisis and problems in the child protection division. Although an independent report last year suggested the state fund childcare and counseling for parents at risk of abusing their children, Republicans shot down Democrats’ attempts to include that money into the budget.

“This fails to provide services for our frail citizens but does include a tax cut for the wealthiest in our state,” said House Minority Leader Steve Shurtleff, a Democrat.

The spending plan represents a compromise deal struck by House and Senate GOP leaders during a committee of conference.

Unlike most session days, lawmakers weren’t allowed to make changes to the plan from the floor on Thursday. The budget passed the Senate, 14-9, along party lines. In the House, when the first tally of 198-169 appeared on screens positioned at the front of Representatives Hall, some members began clapping while others whistled. The budget rider bill later passed the House by an even wider margin, 212-161. The spending bill is set to take effect on July 1, once signed by Sununu.

Though Republicans, in control of the House, Senate and corner office for the first time in more than a decade, were able to pass a budget, divisions still remain.

Freedom Caucus members praised Sununu and Senate leaders for working to lower budget spending, but left Jasper out of their thanks.

The two-term speaker brushed it off.

“It shows that to a large degree this is personal because had they looked at the facts they would realize that we (the House) caused the spending to be lower,” Jasper said.