At very nearly the 11th hour, Gov. Tim Walz has struck a budget deal with House and Senate leaders, producing an agreement that, like any real compromise, offers mixed results for all sides.

Walz and House Democrats managed to hang on to the provider tax that undergirds the state’s public health services. The sunset of that tax Republicans had engineered in a previous session is gone. Although the tax is lowered from 2% to 1.8%, that it stays in place is a tangible victory for sound policy and will provide continued funding needed to provide health care to those who depend on it for their very lives.

Republicans scored their own win — they fended off the entire 20-cent-a-gallon gas tax increase that Walz had said was needed to repair roads and bridges. Although Walz’s initial proposal was overlarge, the lack of any new gas tax funding makes losers of Minnesotans who must drive on deteriorating roads and bridges. The alternative is to finance improvements through bonding, with its added decades of interest payments ballooning the costs.

Senate Republicans agreed to a $500 million bonding bill as part of the pact, most of which would go for roads, but there’s a potential catch. The minority House Republicans were left entirely out of the dealmaking, and their leader, Rep. Kurt Daudt, is unlikely to put up the necessary votes. Bonding bills require supermajorities, and House Democrats are six votes short.

Schools will see a substantial increase of 2% each year for back-to-back years, a healthy investment that falls a little short of Walz’s more ambitious 3+2, but reflects, in the final analysis, a welcome consensus on the need for a strong educational system.

It is disturbing that a similar agreement wasn’t spelled out on critical federal election funds that Senate Republicans have blocked. Senate Majority Leader Paul Gazelka has said previously that the money would be released this session. We will take him at his word that the $6 million that has sat idle for a year now will soon be put to work shoring up vulnerabilities in this state’s election cybersecurity systems.

Congratulating the two sides on coming together is customary at this point. We do appreciate that they finally pulled back from the brink and spared Minnesota either prolonged fighting or, worse still, the government-on-autopilot that the Senate’s last proposal would have produced. That kind of end-run to avoid compromise should never be tolerated and, one would hope, will not be repeated.

Legislators are sent to St. Paul to make the hard decisions and the tough compromises. That’s the job, and it’s not for purists. Walz, Gazelka and Speaker Melissa Hortman worked hard to build relationships throughout the session and to keep rancor to a minimum. In their joint appearance on Sunday night, each singled out the other two for heartfelt praise and respect, and that was a heartening sight.

There is still much work ahead of legislators. Myriad differences on massive spending bills now must be negotiated by conference committees at light speed. Hortman tried from the very beginning of this session to change the dynamic that results in such chaos and dysfunction. She made some headway and should be commended for that. It fell short of what was needed, and we hope all involved will redouble their efforts next time. Hasty deals often make for sloppy outcomes. We can do better.

Minnesotans expect their legislators to fight hard for their agendas and principles, but also to recognize when the fighting must end and compromise begin. That is the essence of our democracy.

As lawmakers navigate the details, there must be no blowups or tantrums that derail this agreement. Those who didn’t get what they wanted will have another chance — next year.

Opinion editor's note: This editorial was updated after the budget deal was announced on Sunday evening. Some of the reader comments below apply to the earlier version.