It’s called a Pyrrhic victory: a win, but a win that so badly harms the winner that it may have well been a battle lost.

For example, the situation now faced by Democrat Attorney General Mark Herring. With his “win” on a redistricting case at the U.S. Supreme Court, he may have sunk the whole of Obamacare.

Let’s start with some history. A coalition of Democrats sued over the Virginia House of Delegates 2012 line redraw, claiming it was a racial gerrymander. After the case went all the way to the U.S. Supreme Court and back, Herring decided to stop defending the lines.

Herring’s argument was simple: he thought the lower court had it right, and as such refused to do his job and defend the Commonwealth’s law defining the districts.

The House of Delegates stepped in to defend the law, taking the case all the way back to the Supreme Court. In the end, the court held that the House by itself had no standing to sue.

As Justice Ruth Bader Ginsburg wrote:

“The House, we hold, lacks authority to displace Virginia’s Attorney General as repre-sentative of the State. We further hold that the House, as a single chamber of a bicameral legislature, has no stand-ing to appeal the invalidation of the redistricting plan separately from the State of which it is a part.”

Fast forward to July. A group of states led by Texas have sued over the Affordable Care Act, arguing that since the parts of the law that rendered it a constitutional tax had been stricken, the balance of the law was now unconstitutional.

U.S. Attorney General William Barr has said he agrees with the decision of a lower court that the law is unconstitutional, and the Department of Justice will not pursue an appeal.

The House of Representatives has stepped in to defend the law. This is where Mark Herring may have cost Democrats dearly.

Had Herring done his job and defended Virginia’s districts, there would be no binding Supreme Court precedent disqualifying a single chamber of a legislature form suing to protect a law.

In short, Mark Herring has likely undone Speaker Nancy Pelosi’s efforts to save Obamacare. All because he didn’t want to do his job.