Minnesota's divided Legislature quashed lingering fears about a partial government shutdown Wednesday, passing the final piece of a $52 billion budget that pours money into classrooms.

Lawmakers had just hours to spare before a midnight deadline as they approved a massive spending package to support K-12 education. They later approved a tax relief package that included nearly $1 billion in tax cuts.

"We obviously would have liked to have it done a little earlier, but that's the way things work," said Gov. Tim Walz, who hand-delivered the signed copy of the education budget to the Secretary of State's Office just before 8 p.m. The governor signed all of the remaining budget bills on Wednesday.

"Democracy moves at its pace," he said.

Legislators trumpeted the compromises reached over a lengthy special session and said an infusion of federal cash was critical as they sought to help people financially rebuild from the pandemic.

"That really was the main goal, besides doing a budget — addressing the hardships that individuals and businesses and families were going through the past 15 to 16 months with COVID-19," said Rep. Paul Marquart, DFL-Dilworth.

About 80% of the tax bill is related to COVID recovery relief, said Marquart, who chairs the House Tax Committee.

The education funding bill lawmakers completed Wednesday is the largest single piece of the budget and will pump $1.2 billion more into classrooms over the next four years, most of which will go toward increases in a funding formula that supports school districts.

"It's a simple bill. Money, not mandates," said Sen. Roger Chamberlain, R-Lino Lakes, who sponsored the measure. "The formula is the largest increase in 15 years."

Walz announced plans Wednesday for how the state will use $132 million in flexible federal education funding through the American Rescue Plan. The state got $1.3 billion for early childhood through high school education under the federal plan, and 90% of the dollars went directly to schools.

The governor said he would use the remaining 10% for after-school and summer enrichment programs, grants to public schools and helping students make up for classroom time lost to the pandemic.

"Minnesota's students and families faced so many challenges throughout the pandemic, and supporting every one of them remains a top priority, especially as we head into the next school year," Walz said in a statement. "This funding allows us to invest in things that did not find agreement in the education budget, but that we know our students need in order get back on track and stay on track in school."

The final day of the special session was not without some last-minute maneuvering. There was still a chance legislators could pass a public infrastructure borrowing bill, known as a bonding bill, said Senate Majority Leader Paul Gazelka, R-East Gull Lake. He said the Senate did not plan to leave town immediately after the K-12 and tax bill votes.

Lawmakers are constitutionally required to pass a balanced budget before July 1, the start of the new fiscal year, or state services begin to shut down. Tax measures and bonding bills are not required for a balanced budget, but Republicans consider tax relief a top priority of the session.

Meanwhile, Democrats made a last-minute push to include a capital project grant program in the tax bill that would go to nonprofits and government entities serving economically disadvantaged or underserved communities.

The tax deal provides breaks to businesses that received payroll loans and workers who collected unemployment during the pandemic. The bill also includes language to establish a nine-person commission that would make recommendations to the Legislature this fall on how to divvy up $250 million in federal aid for essential workers, such as nurses and custodians who continued to go into work during the pandemic.

Ahead of final votes on the tax measure, workers gathered at the Capitol and called on legislators to distribute that money as quickly as possible.

"The promise of a payback is empty if workers can't get the funds they deserve, and they need it now," said Mary Turner, a registered nurse and president of the Minnesota Nurses Association.

"This is not bonus pay. Bonuses are for bankers. This is backpay. This is what's due for the workers who went above and beyond and sacrificed to keep everyone safe."

Gazelka said he expects lawmakers will hold another special session in early September to approve the decisions of the nine-person commission. He said Senate Republicans will prioritize workers providing long-term care.

If they are not able to reach a deal on a construction bonding bill this week, the Legislature could attempt to pass one when they return in September, Gazelka said.

The final votes on taxes and education Wednesday followed days packed with debates on various pieces of the state budget, including health and human services, housing, state government programs and public safety. Legislators struck a deal and passed a budget Tuesday that funds corrections, state law enforcement agencies and the courts. It included a handful of police accountability measures that were a priority for House Democrats.

Advocates continued to protest the package Wednesday at the Capitol, saying it didn't go far enough. They called for Walz to reject the bill and suggested they will ramp up protests over the summer.

Staff writer Stephen Montemayor contributed to this report.