ST. PAUL, Minn. (AP) — A midnight deadline to adopt a new two-year budget bore down Monday on the Minnesota Legislature, which could be in for an overtime session due to a rift over preschool funding.

Split-party control and deadline pressure brought on the usual, messy end to the legislative session as Republicans, who run the House, and Democrats, who hold the Senate and governor’s office, tussled over how to spend a nearly $2 billion surplus.

READ MORE: How Minnesota Schools Are Spending COVID Relief Money

Legislators worked around the clock over the weekend to piece together a nearly $42 billion budget that would boost funding to rural nursing homes, aid farmers affected by a deadly bird flu outbreak and increase health care premiums for more than 90,000 working poor residents on a subsidized program.

But with hours to go before Monday’s midnight deadline and Gov. Mark Dayton’s veto threat looming, an education budget was the main event — a linchpin to either a timely finish or a special session.

After working through the night, the House voted along party lines for a $17 billion education plan with $400 million in new school spending. The Democratic-controlled Senate is expected to follow suit later Monday. But Dayton insists he’ll veto the bill because it leaves out money for a preschool expansion initiative at the core of his agenda.

A veto of the education bill — or any other parts of the state’s budget — could trigger the state’s third special session in a decade. The next budget must be in place by July 1 to avoid a partial government shutdown.

Other elements of the budget were still in flux as the sun came up on the final day and many portions were awaiting final votes. Legislative leaders expressed confidence that they would finish in time, even as Dayton warned he would summon them back. Just where they would hold a special session is unclear.

The House and Senate chambers will be off-limits beginning Tuesday because of a major Capitol renovation project. Dayton floated the idea of pitching a tent on the front lawn rather than renting space, a suggestion Senate Majority Leader Tom Bakk dismissed as unlikely.

In an unusual move, a pact struck between the top legislators will leave $1 billion of a nearly $1.9 billion projected surplus uncommitted. The money was set aside for tax cuts or transportation spending that will be considered in the 2016 election-year session after failure to strike an accord on those fronts this year.

READ MORE: Girl Gifts Comforting 'Prairie Bears' To All Patients At Youth Psychiatric Hospital

Dayton and many legislative Democrats complained that the state’s youngest learners were being shortchanged while money for potential tax cuts is stockpiled.

“Too often our rhetoric doesn’t match our action. Too often our action is leaving kids behind,” said Rep. Erin Murphy of St. Paul as she cast the education bill as mediocre. “We’re going to put a billion dollars into a piggy bank and think about what we’re going to do with it next year.”

Rep. Matt Dean, R-Dellwood, said the unspent money is clearly causing angst.

“You better have a hockey helmet on because what I see is there is a mad rush to spend that 16 times over,” Dean said.

Republicans argued that Dayton hadn’t made a strong enough case for setting up half-day school programs for all 4-year-olds that will eventually cost the state hundreds of millions of dollars. They raised doubts about space for the new grade in schools and said it would threaten the viability of privately run day cares.

“The time for the governor to get the votes to pass pre-K was one, two, three, four, five months ago,” said Sen. Sean Nienow, R-Cambridge. “The governor, if this was his top priority, needed to build his coalition and get his votes months ago not three days or two days or one day before the legislative deadline.”

Meanwhile, another Dayton priority fell into place.

Lawmakers made late changes to a plan toughening rules for vegetation buffer zones separating farmland and public waterways in an effort to prevent chemical runoff. The revised plan calls for buffers of at least 30 feet in width but an average of 50 feet along public waters. The strips could be narrower along drainage ditches. Compliance deadlines would be late 2017 for public waters and 2018 for ditches. Farmers who don’t comply could face fines and orders for corrective action.

MORE NEWS: Good Question: How Do They Make It Snow Inside U.S. Bank Stadium?

(© Copyright 2015 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)