From left, Speaker of the House Kurt Daudt, Gov. Mark Dayton and Senate Majority Leader Paul Gazelka announce their plans for completing their work on the final day of the regular legislative session May 22, 2017, at the State Capitol in St. Paul. (Scott Takushi / Pioneer Press)

The long hours take their toll on Senators as they listen to Ron Latz, (DFL), St. Louis Park speak on the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

Rep. Rod Hamilton (R) of Mountain Lake discusses the public safety bill in the House on the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

Papers are exchanged on the Minnesota House floor during a recess as lawmakers struggle to finish their business Monday, May 22, 2017. (Dave Orrick / Pioneer Press)

Rep. John Lesch of St. Paul feeds his 11 month-old daughter Eleanor from a bottle during the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)



Rep. Susan Allen, (DFL) from Minneapolis discusses the public safety bill on the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

Even visitors in th Senate gallery were tired and bored on the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

Senate Minority Leader Tom Bakk, (DFL) Cook, talks with lobbyists in the hallway outside the Senate Chambers, on the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

Bryce Wickstrom, a field representative of of the labor organization AFSCME Council 5, checks his phone while holding a sign that reads "AFSCME IS WATCHING" in front of a statue of Civil War Col. William Colvill in the Minnesota Capitol rotunda Monday, May 22, 2017. (Dave Orrick / Pioneer Press)

Lynette Kalsnes, a communications work with the labor organization AFSCME Council 5, take a picture of AFSCME volunteers making their presence felt outside the House chambers Monday, May 22, 2017. (Dave Orrick / Pioneer Press)



Minnesota Rep. Peggy Flanagan, DFL-St. Louis park, speaks to a rally for immigrant rights outside the offices of Gov. Mark Dayton shortly after the house passed a bill that bans drivers licenses for undocumented immigrants Monday, May 22, 2017. "The fact that you are still here, it matters," Flanagan told the group. (Dave Orrick / Pioneer Press)

State Rep. Tony Cornish, R-Vernon Center, discusses the public safety bill with Shannon Rousseau of KTTC-TV Rochester outside House chambers Monday, May 22, 2017. (Dave Orrick / Pioneer Press)

With both the House and the Senate in recess at about 9:30 pm, people stand around the hallways and watch the Stanley Cup on the final day of the regular session at the State Capitol in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

The State Capitol at dusk on the final day of the regular session in St. Paul, Monday, May 22, 2017. (Scott Takushi /Pioneer Press)

Minnesota legislators blasted past their midnight deadline Monday to get their work done — but will come back immediately to finish the job.

Forty-five minutes before their constitutionally mandated end of this year’s five-month legislative session, Republican legislative leaders joined with Democratic Gov. Mark Dayton to announce they had reached a deal on how much money to spend on tax cuts, transportation, health and human services and public schools.

“I’m grateful that we have a deal,” said a smiling but weary Republican Senate Majority Leader Paul Gazelka.

The deal means a liberal Democratic governor looking to preserve state programs and his legacy and a newly powerful Republican legislative majority aiming to shift Minnesota to the right managed to agree on how to spend $46 billion over the next two years.

But they will need more time to complete the job.

Dayton said he agreed to call lawmakers into special session just past the stroke of midnight. The agreement means they will have until Wednesday morning to approve a $990 million state building measure, an $18 billion school budget and around $14 billion for health and human services programs.

None of that will happen quickly.

“This will not be the all-nighter,” House Speaker Kurt Daudt, R-Crown, said Monday night. “Tomorrow night will be the all-nighter to get things done.”

WHAT HASN’T BEEN DONE YET

Lawmakers have been working on the state’s budget for months, but they ran out of time before their midnight deadline to negotiate and approve budget bills funding public schools, health and human services, roads and bridges and tax cuts. Those measures make up about 70 percent of the state’s budget.

The agreement came only minutes before the clock struck midnight, and was capped with an actual handshake between Republicans and Democrats who had spent hours locked in private rooms trying to find a middle ground.

“I think we decided we were all in,” Gazelka, R-Nisswa, said.

The sticking points were nothing new. They’re fights Republicans and Democrats have waged all session — and in sessions past.

Bargaining over health and human services spending was the most difficult. Republicans said it was necessary to reduce spending there to protect the state from fast-rising costs, while Dayton argued cutting budgets in those areas would harm Minnesotans in need.

Dayton and Republican lawmakers’ biggest disagreement in the education area had been over how much to spend on which preschool programs and how to spend it. Over the weekend, Dayton persuaded Republicans to drop a provision that would give tax breaks for donations to help low-income students attend private schools. Many public school advocates opposed the measure.

On taxes, Dayton and GOP leaders agreed to give $660 million of the state’s budget surplus back to taxpayers. Related Articles Early voting in Minnesota starts Friday. Any questions?

Gov. Walz, Minnesota’s pointman on COVID-19, looks back with some regret

Senate Republicans oust second Walz cabinet member as governor extends pandemic emergency

The pandemic changes how candidates run for the Legislature

MN Gov. Tim Walz calls Friday special session; plans to extend powers

Leaders sparred over how to pay for maintaining the state’s roads and bridges as well as how much state money to spend on public transit. Dayton hoped to create a new funding stream, but Republicans have stood firm on the notion that existing resources should cover the costs. The final deal spends $300 million more in existing revenue for transportation, with no new sources of revenue.

To meet long-simmering needs, Republican and Democrats are planning to approve a $990 million statewide infrastructure bill.

The final agreement also permits the Legislature to send Dayton a “pre-emption” measure during a special session that would take away local cities’ ability to approve local labor ordinances. Minneapolis and St. Paul soon will have paid time-off requirements, and leaders of both cities have looked at lifting the minimum wage for all workers in their cities.

Asked what the fate of that measure would be, Daudt just smiled.

Dayton, however, was clear.

“I won’t sign a bill for pre-emption. I’ve already made that clear,” the governor said.

The leaders and the governor released only the broad outlines of their deal: Exactly how the money will be spent, whether state agencies are funded to the level Dayton demanded and how the preschool money will be divvied up have not yet been disclosed.

Lawmakers worried about those details.

“We have no idea right now what’s in the deal,” said Rep. Jean Wagenius, DFL-Minneapolis. “The key, is do we have enough time to look at these bills and understand what’s in them?”

“Obviously, the devil’s in the details, so we have to wait and see,” said Dan Fabian, R-Roseau.

WHAT DID GET DONE

Despite the need for an overtime session, lawmakers did pass several major parts of the state budget on time. Bills funding agriculture, the environment, public safety, higher education and economic development programs all passed the Legislature and are on their way to Dayton’s desk for a signature or veto.

These five parts of the budget will spend an estimated $6.1 billion over the next two years. Lawmakers agreed to increase spending in all five areas after negotiations with Dayton.

Dayton has not yet signed any of these budgets into law. If the governor doesn’t sign or veto the bills within three days, they become law.

The Legislature also passed several other bills of high importance.

In the final week of session, lawmakers finally passed a bill to bring Minnesota driver’s licenses into compliance with the federal Real ID Act. Without that bill, Minnesota licenses could have become invalid for airport security next year.

Earlier in the session, they passed two bills to help Minnesotans struggling with high premiums on the individual health insurance market. One spent $310 million to give 25 percent discounts to people buying insurance this year, while the other set up a $572 million program to try to lower premiums in the next two years.

After years of debate, the Legislature also legalized Sunday alcohol sales.

But all that was forgotten as Monday’s deadline drew nearer with no final deals on the budget plans.

“Usually as we’re getting closer to deadline, it’s kind of like watching a tub drain,” said Sen. Warren Limmer, R-Maple Grove. “It starts looking like it’s going faster and faster as there’s less water in the tub. I haven’t sensed that today.”

Bill Salisbury, Christopher Magan, Tad Vezner and Dave Orrick contributed to this report.

READ THE SPECIAL SESSION AGREEMENT