Gov. Mark Dayton on Tuesday agreed to legislation to completely fund Minnesota state agencies the next two years, resisting calls from political allies to torpedo major spending pieces, heading off a potential government shutdown.

The new $46 billion two-year budget will take effect in July. It was passed during a special session last week that piggybacked on a regular session because lawmakers and Dayton couldn't finish the job on time.

Dayton had said that he would not sign the tax bill, and cited a state attorney general opinion that the bill could become law without his signature. But later Tuesday night, Dayton signed the bill on the "advice of my general counsel," according to a letter to House Speaker Kurt Daudt, R-Zimmerman.

Dayton added that, by signing the bill, he was protecting funding for the Minnesota Department of Revenue. Earlier he chastised Republican lawmakers for adding what he called a "poison pill" provision to a bill that would have eliminated all Minnesota Department of Revenue funding if it were killed, a move the governor described as a "reprehensible sneak attack."

In response, Dayton used his power to eliminate spending for the House and Senate.

The gravity of that move wasn't immediately clear but it's certain to trigger a confrontation with GOP legislative leaders.

When asked about slashing legislative funding, Dayton told reporters, "Well, they can come back and get it restored .... we'll find out how much money they have stashed away" in reserve accounts.

The governor said he would be willing to call a special session but only if lawmakers agreed to cut out provisions he still finds distasteful, including tax relief on tobacco products.

Republican leaders said later they do have money in reserve to operate but only for a month or two. Senate Majority Leader Paul Gazelka, R-Nisswa, said the Senate had a $3 million reserve; Daudt said his chamber had $7 million.

"We don't think it's constitutional" Gazelka said of Dayton's move. He called the situation unprecedented.

Despite expressing reservations about each bill that makes up the budget, Dayton went along with what the Republican-controlled Legislature sent his way.

It will mean $650 million in targeted tax cuts, back-to-back 2 percent increases in basic school allowances, a burst of new transportation dollars and some cost-shifting for publicly subsidized health care programs.

Left-leaning groups had urged Dayton to block the bills, arguing they contained poison pills that were either mean-spirited or ill-advised.

Full coverage: Politics

For instance, the statewide teachers union found new licensure rules objectionable and said they would result in a lowering of standards for instructors.

Advocates for immigrants are outraged over a legal blockade on the issuance of driver's licenses for those living here without proper authorization, although Republicans say that's the case already. Backers of mass transit took aim at the transportation bill, saying the funding is insufficient and will lead to fare hikes.

A group of DFL senators and House members picked apart the transportation bill in a letter to Dayton this week.

"It fails to deliver on the extremely important investments we need to make in both the immediate and long term, in the basic infrastructure to build a successful, prosperous state. It fuels the negative politics of division, resentment and exclusion," they wrote. "It is not worthy of your signature." Republican lawmakers traveled the state Tuesday to hail 2017 as "one of the most-productive sessions in recent history," as Daudt put it during a recent stop in Rochester, Minn.

Gazelka echoed Daudt and pointed to passage of a bill to allow Sunday liquor sales, to shore up the individual insurance market and to eliminate worries about Minnesota driver's licenses being rejected at airport checkpoints.

"To make that happen we had to unlock the gridlock with the governor," Gazelka said during the mid-morning stop. He said if the bills didn't become law, he doubted "they were going to get any better."

Gazelka added, "We spent way more money than we thought we should spend on each of the budget areas. That was our compromise."

They'd expressed confidence that Dayton would come aboard.

House Taxes Committee Chair Greg Davids, R-Preston, said the tax cut bill passed with more than 100 votes, so he didn't see how Dayton could stop it.

"When the governor signs the bill, there is one true winner, and that is everyone in Minnesota," he said.

Dayton did deliver one veto. He struck down a change to labor standards that would have derailed plans in Minneapolis and St. Paul to require employers to provide sick leave and short-circuited proposals to boost the minimum wage beyond the $9.50 per hour the state demands.