Colorado’s rural schools are likely to receive a one-time boost of $30 million next year after state lawmakers found compromise on a massive spending overhaul aimed to save rural hospitals from devastating budget cuts.

The state Senate on Friday gave bipartisan support to Senate Bill 267, sponsored by state Sens. Jerry Sonnenberg, a Sterling Republican, and Lucia Guzman, a Denver Democrat.

The bill also sends money to roads, increases some co-pays for patients on the state’s insurance program and raises taxes on recreational marijuana to the maximum 15 percent.

All of Colorado’s schools will benefit from the bill, but not immediately. If passed, the bill would send $20 million a year in 2018 and 2019 to the state education fund, a state savings account for schools.

Part of what makes the bill so controversial is that the cornerstone of the bill would redesignate a fee collected by the state that helps pay for Medicaid. Republicans have staunchly opposed the measure. But some, including the bill’s sponsors, came around to the idea as hospitals faced massive cuts in next year’s budget.

“I’m so excited about being able to come to agreement,” said Sonnenberg, the Sterling Republican who led the negotiations. “It will be a huge addition for rural schools that haven’t been able to buy buses or make any upgrades.”

While the bill is likely to remembered as one of the greatest bipartisan compromises of the decade, it is not without detractors.

“I believe this is one of the worst pieces of legislation I’ve seen in my 15 years at the legislature that has a real chance of becoming law,” said state Sen. Kevin Lundberg, a Berthoud Republican.

Many Senate Republicans believe the bill is too broad and does not do enough to curb government growth.

The bill’s journey has not been a linear one. Sonnenberg had threaten to kill his own bill more than once. And there were multiple times the four lawmakers were close to a deal, but then had to return to the bargaining table.

The final compromise is a far cry from what was originally proposed for the state’s rural schools.

“Though the amount allocated to rural schools through the compromise is far less than the $79 million initially set forth in the bill, we know that the additional funds will relieve some amount of pressure,” said Michelle Murphy, executive director of the Colorado Rural School Alliance. “The effort put forth by the bill sponsors to reach a compromise on the critical — and contentious — components of the bill has been remarkable.”

The Senate is expected to give final consideration to the bill Monday. Then the House of Representatives must debate the bill.