Virginia Democrats are right to be furious that Republicans used a sleazy job offer and a parliamentary gimmick to block Gov. Terry McAuliffe’s top goal of expanding medical insurance for the state’s working poor.

Rejecting both compassion and common sense, the GOP went to extraordinary lengths to ensure that Virginia would refuse $2 billion a year in federal funding just because the money was tainted by association with dreaded Obamacare.

But after the Democrats have finished gnashing their teeth, they should study the lessons from this major defeat and figure out how to win the contest in the end.

It’s a formidable challenge. There’s no getting around the fact that McAuliffe broke one of his principal campaign promises when he signed a budget that didn’t expand Medicaid.

House Speaker Bill Howell (R-Stafford), a disciplined adversary with a prickly wit, gave McAuliffe an early tutorial in Richmond gamesmanship.

Howell knew the key to winning was holding together his supersize GOP caucus in the House. He was able to do so partly because Republicans who alienated their conservative base last year by raising taxes for transportation weren’t about to double their trouble by expanding Medicaid anytime soon.

The speaker ultimately forced McAuliffe to yield on Medicaid or fail to pass a budget by the July 1 deadline.

Howell got an unexpected assist from the Senate when former senator Phil Puckett (D-Russell) resigned June 9, handing control of the chamber to the Republicans.

Puckett was enticed to quit partly by the promise of a cushy job on the state tobacco commission, whose chairman is a Republican delegate. Puckett ultimately turned down the job, but the FBI is investigating.

In the endgame, McAuliffe vetoed a budget provision in hopes of retaining some flexibility to expand Medicaid on his own. But Howell declared the veto out of order.

McAuliffe tried to put the best face on his setback with defiant rhetoric promising to bypass the legislature anyway and extend health coverage through executive action. That would risk a constitutional crisis and aggravate partisan hostilities already described as the worst in decades.

For all his bravado, McAuliffe is treading carefully. It didn’t get much notice, but the governor stopped short of promising that any unilateral action would necessarily include accepting Obamacare dollars to insure up to 400,000 low-income Virginians. He might propose a much less ambitious program.

As I wrote in a June 5 column, I don’t think McAuliffe should impose Medicaid expansion on his own. I doubt he has the legal authority, and it would set a bad precedent.

Instead, he should set about peeling away enough Republican votes over time to achieve the goal forthrightly.

He should start by better educating the public about the sizable health and economic advantages of expanding Medicaid.

“I don’t think the McAuliffe people sold Medicaid expansion very well,” said Quentin Kidd, a political scientist at Christopher Newport University. He said they should have done more to show voters how hard-working families would benefit.

“Their approach was to play an insiders’ institutional game — let’s get chambers of commerce and hospitals on our side,” Kidd said. “I didn’t see them put a human face on Medicaid expansion.”

Democrats also need to step up efforts to make the party more competitive in legislative elections, especially in rural Virginia. Republican legislators in southern and western Virginia aren’t feeling enough heat for rejecting a program that would benefit thousands of their constituents.

(Ultimately, Democrats need to be in a position in 2021 to redraw legislative districts to end their underrepresentation in the House of Delegates. The GOP gained a significant advantage there when it had the edge in the last two redistrictings in 2001 and 2011.)

The arguments for expanding Medicaid will grow stronger with time. Virginia will look increasingly foolish for turning away federal dollars while other states show no such self-destructive restraint. Even conservative Republican governors in Ohio and Arizona support Medicaid expansion.

Republicans will gradually tire of being, once again, the party that says “no” to helping low-income people.

Remember that it took more than three years for McAuliffe’s Republican predecessor, Bob McDonnell, to achieve his landmark transportation bill.

Most Republicans didn’t like that, either. Ultimately, enough went along because the logic was so persuasive.

I’m taking a break. The column will resume when I return. For previous columns, go to washingtonpost.com/mccartney.