Del. Lionel Spruill, D-Chesapeake delivers a speech on Medicaid expansion issues during the House session at the Capitol in Richmond, Va., on Sept. 18. (Steve Helber/AP)

State legislators united across party lines Thursday to plug a $2.4 billion hole in the state budget but quickly reverted to bitter partisanship as they debated Medicaid expansion, with House Republicans ultimately killing a bill to expand the health-care program without giving it a formal vote.

The House and Senate voted overwhelmingly to fix a projected shortfall in the two-year, $96 billion state budget by tapping the rainy-day fund and trimming spending at most state agencies and public universities. The votes came days after Gov. Terry McAuliffe (D) and House Speaker William J. Howell (R-Stafford) teamed up to announce a plan to bring state spending in line with a projected shrinkage of revenue, which Virginia leaders blamed on federal defense cuts.

The bipartisan spirit did not extend to the rest of the special session, whose primary purpose was to debate McAuliffe’s top legislative priority: extending Medicaid to 400,000 uninsured Virginians.

The GOP leadership called for the session and allowed a new bill calling for expansion to make it to the House floor. But after extended debate, Republicans used a procedural move to prevent the measure from advancing to a final vote. It died on a 64-to-33 vote against “engrossing” the bill and did not advance to the Senate.

Democrats and Republicans not only debated the benefits and risks of expanding the program but sparred over whether the special session itself was a “full and fair hearing” of the issue or a highly expensive “fake debate.”

Comments on the floor quickly made plain that neither side of the aisle had shifted from firm positions that had threatened to trigger a state government shutdown before the Medicaid issue was severed from the budget process in June.

A vote earlier in the evening suggested that Republicans were only digging in deeper against expansion. The House voted 65 to 32 for a resolution authorizing the speaker to hire an attorney who could sue the governor if he sought to expand Medicaid without the assembly’s approval.

The resolution, which does not need approval from the Senate, will allow the speaker to hire legal counsel to defend the state constitution and laws if the attorney general chooses not to do so. Conservatives were infuriated this year when Attorney General Mark R. Herring (D) switched the state’s position on a lawsuit challenging Virginia’s ban on same-sex marriage. Herring not only declined to defend the measure but sided with plaintiffs, arguing that the ban was unconstitutional.

Under the federal health-care law, states may extend Medicaid to people with incomes up to 133 percent of the federal poverty line, which is $23,850 a year for a family of four. The federal government has pledged to pay most of the cost — about $2 billion a year in Virginia.

The session began the way the last one closed: with most Republicans and Democrats staking out starkly different positions on expansion. Democrats said it made no sense to turn down $5 million a day in federal funds that could be used to insure 400,000 Virginians. Republicans said it would be foolish to expand a program that is already growing by 8 percent a year and consumes more than 20 percent of the budget.

Del. Michael T. Futrell (D-Price William) made an emotional appeal for expansion, starting by thanking fellow legislators for their support when his wife gave birth to their baby girl in July, two months early. As he kept vigil by his daughter, Melanie, in the neo-natal intensive care unit, Futrell said he often saw a father of premature twins who did not have health insurance.

“This man had another set of worries,” Futrell said. “This could have very easily been my family. All I ask is that we do something.”

Republicans countered by noting that the Affordable Care Act was causing some people to lose insurance. Del. Kathy J. Byron (R-Bedford), chairwoman of the Virginia Health Insurance Reform Commission, said that the panel learned just last week that 250,000 Virginians would lose their health insurance by January because the policies do not meet the standards set by the ACA.

There was also debate over the purpose of the special session. Democrats suggested that Republicans were wasting time and money — it costs the state $50,000 a day in legislative per diems to bring lawmakers back to Richmond — to bring the legislature into session without any real intention of passing legislation.

Del. Scott A. Surovell (D-Fairfax), who was elected Democratic caucus chairman earlier in the day, was among the Democrats who portrayed the session as an expensive charade — he called it a “fake debate” — particularly since the Medicaid bill was not scheduled to come up until after passage of budget amendments, meaning no money would be provided for expansion despite what was said.

House Majority Leader M. Kirkland Cox (R-Colonial Heights) said Republicans called the session to fulfill a promise to give Medicaid expansion a “full and fair hearing.” They never promised to offer a plan for expansion, he said.

The one plan that came to the House floor was, in fact, proposed by a Republican, but his plan was not backed by the House leadership. Del. Thomas Davis Rust (R-Fairfax), the lone House Republican to favor earlier plans for expanding Medicaid under the Affordable Care Act, proposed using federal Medicaid funds to help people pay for private insurance that they already have the option to purchase through their employers but cannot afford.

Democrats praised his plan. Republicans opposed it.

On the budget matter, the House voted 93 to 4 and the Senate voted 37 to 2 with one abstention to amend the state’s two-year spending plan.

McAuliffe and GOP leaders announced Monday that they had worked out a way to bring state spending in line with a revenue shortfall. Spending for K-12 education is spared, but almost every other corner of state and local government will get cut. The plan calls for cuts averaging 4 percent across all state agencies, with the specific cuts yet to be determined. Higher education will be cut an average of 3.3 percent.

The legislature wound up the night by filling about 40 judicial slots in general district, circuit and juvenile and domestic relations courts around the state, including those in Fairfax, Prince William and Loudoun counties. Legislators will return later this year to fill higher-level judicial posts.