Politics can make for strange bedfellows, and that is especially true of the massive transportation funding package that passed the Virginia General Assembly on Saturday.

Gov. Robert McDonnell (R) and the Democrat angling to succeed him, Terry McAuliffe, both supported the measure and worked to drum up votes for it. When the bill passed, McDonnell and McAuliffe even shared what the governor’s spokesman called “a brief congratulatory phone call” about it.

Lt. Gov Bill Bolling (R), who is considering running as an independent, also backed the bill.

On the other side, Attorney General Ken Cuccinelli II, the Republican nominee for governor, criticized the package and nearly derailed it with a last-minute legal objection.

Echoing the views of many conservatives who were unhappy with the package, Cuccinelli said that the bill “contemplates a massive tax increase.”

“In these tough economic times,” he said, “I cannot support legislation that would ask the taxpayers to shoulder an even heavier burden.”

And on Friday night, Cuccinelli issued a legal opinion saying that a proposal to allow a special committee of lawmakers to authorize an expansion of Medicaid in the state was unconstitutional. Democrats were demanding that the Medicaid provision be included in the final budget before they would vote for the transportation measure.

Cuccinelli’s ruling briefly stalled the transportation measure before legislators from both parties were able to find a way around it.

McAuliffe, for his part, called Democrats in both the House and the Senate to urge them to back the deal. After it passed, he took a clear swipe at Cuccinelli.

“Despite last-minute attempts by some right-wing ideologues to stop any progress on transportation, Virginia’s leaders came together in the middle to find compromise,” McAuliffe said.

Cuccinelli’s campaign noted that members of both parties had problems with the deal, including state Sen. Chap Petersen (D-Fairfax), who called it “a grotesque combination of tax cuts, tax rebates, tax increases, new taxes, old taxes which are phased out (and then reappear elsewhere), regional alliances, regional funds, regional goals, statewide goals, special projects, and exceptions to all the above.”

A Quinnipiac University poll released this week showed the Virginia governor’s race to be a dead heat between McAuliffe and Cuccinelli. In a three-way contest, McAuliffe got 34 percent to 31 for Cuccinelli and 13 for Bolling.