Want to know what a real constitutional crisis looks like? Consider the current situation in West Virginia, where the House of Delegates impeached the entire state Supreme Court in August, alleging improper use of government funds. Chief Justice Margaret Workman sued the legislature, alleging that her impeachment violated the state constitution. Her case went to … the West Virginia Supreme Court, where every justice is either disqualified from hearing it or has been suspended without pay. Five acting justices—who were appointed by an appointed justice, who in turn was selected by a retired justice, who was chosen by Workman—heard the case instead. On Thursday, they ruled unanimously in Workman’s favor.

The West Virginia Senate initially planned to ignore the court’s decision and proceed with Workman’s trial. It stood down only when Justice Paul T. Farrell, who was set to conduct the proceedings, announced he would not participate in a trial his own court had found to be illegal. Meanwhile, the House of Delegates has declared it will present its case to the Senate anyway.

This saga is an object lesson in the perils of politicizing the judiciary. A minor conflict over the court’s budget has escalated into a standoff between the court and the legislature, one driven by Republican efforts to wrest control of the judiciary from Democrats. Lawmakers are poised to defy an order of the state Supreme Court, permanently subverting the constitutional separation of powers. There are no real good guys in this story, but some are certainly worse than others. And if Republicans succeed in their scheme, they will have provided a road map to other politicians eager to defang an independent judiciary.

This absurd process yielded a result that’s easy to dismiss as illegitimate.

The West Virginia calamity began in late 2017, when a local news station revealed that the justices had spent large sums of money on office renovations. This spending, while distasteful, was not clearly illegal, as the court has near-total control over its own budget. Still, a bipartisan group of legislators urged further investigations. Republicans delayed action until August because it benefited them politically to do so. The justices are elected, and Democrats have long held a 3–2 majority on the court. Any justice impeached before mid-August would be replaced in November through an election. A justice impeached after Aug. 14, however, would be replaced by Republican Gov. Jim Justice and would not face election until May 2020. The legislature engineered its assault on the court to ensure the governor could replace Democrats with Republicans.

Still, the court itself was not blameless. Justice Menis Ketchum, a Democrat, resigned from the court in July then pleaded guilty to a felony count of wire fraud. Justice Allen Loughry, a Republican, was indicted in June for fraud, false statements, and witness tampering. Loughry, who was suspended from the court but refuses to resign, was convicted on multiple counts of fraud and false statements. The other three justices—Workman, Robin Davis, and Beth Walker—are accused of less serious wrongdoing, namely exorbitant use of state funds. Davis resigned rather than face impeachment and is suing the legislature in federal court. Walker, a staunch conservative, was acquitted by the Senate in October. It appears likely that Republicans never intended to remove Walker and impeached her only for consistency’s sake, since she too spent a great deal of money ($130,655) to upgrade her chambers.

That leaves Workman, a liberal lion who was elected to the court in 1988, stepped down in 1999, and then was elected to the court again in 2008. Like her colleagues, Workman spent a questionable amount of money ($111,035) renovating her chambers. Along with Loughry and Davis, she also overpaid retired judges who filled in on circuit courts, exceeding the statutory limit (though complying with the pay scale promulgated by the court itself). Workman was impeached on the basis of her imprudent spending and overpayments. In September, she sued the legislature, alleging that her impeachment violated the state constitution and urging the state Supreme Court to halt her impending Senate trial.

This presented a problem: There is not really a West Virginia Supreme Court at the moment, at least not one that can adjudicate this dispute. Workman disqualified herself from hearing her own case. Walker disqualified herself, as well, since she faced a similar charge to Workman. Loughry remains suspended, and Acting Justice Paul Farrell Sr., who is temporarily replacing Loughry, disqualified himself too. Justices Tim Armstead and Evan Jenkins, whom the governor appointed to replace Ketchum and Davis, also declined to participate, apparently due to the potential conflict of interest. There are thus zero sitting justices able to hear Workman’s case.

In response, Workman herself asked a former justice, Thomas McHugh, to appoint an acting chief justice. McHugh selected Harrison County Circuit Judge James Matish. Then Matish appointed four acting justices to replace Walker, Armstead, Jenkins, and Farrell (who is himself replacing Loughry). It was this court that heard Workman’s case—a court selected by neither the people of West Virginia, nor the legislature, nor the governor.

On Thursday, this makeshift court ruled emphatically in Workman’s favor, holding that the legislature’s actions violated both separation of powers and due process. The state Senate could not lawfully remove Workman for overpaying senior judges, the court explained, because the state constitution grants the court sole authority for promulgating its own rules. While the legislature attempted to limit these payments, the chief justice expressly overruled these restrictions, and Workman therefore acted within her constitutional authority in disbursing larger paychecks. Moreover, the court found that the legislature has no power to impeach a justice based on alleged violations of the West Virginia Code of Judicial Conduct. Once again, the state constitution permits the court, and only the court, to enforce this code. An unproven allegation that a justice flouted the code may not provide the basis for impeachment. So Workman cannot be removed for allegedly violating the code by spending too much on renovations.

The court also found that the legislature infringed upon Workman’s due process rights by departing from the legal procedures that govern impeachment. Oddly, the House of Delegates failed to set out “findings of fact” in its articles of impeachment—a clear obligation under state law. The House also declined to explain how precisely Workman’s conduct constituted an impeachable offense. As a result, the court held “in the strongest of terms” that the legislature contravened due process and invalidated all articles of impeachment against Workman. (All five justices agreed that the proceedings violated separation of powers, but two held that the court should not have resolved the due process claim, viewing it as a political question, not a legal one.)

Stripped of its legalese, this decision clarifies what most observers already know: This impeachment is fundamentally political, and the legislature has executed it in a remarkably incompetent manner. The West Virginia Constitution permits impeachment “for maladministration, corruption, incompetency, gross immorality, neglect of duty, or any high crime or misdemeanor.” It’s telling that the House did not even attempt to explain how Workman’s conduct fit any of these categories. The chief justice expended funds in accordance with judicial guidelines. For better or worse, the constitution allows the state Supreme Court to create its own regulations and procedures. Workman did not violate them. How can she be impeached for “maladministration” when she administered the court in accordance with its own rules?

Regardless, Thursday’s decision is already under attack from Republicans, who appear eager to reject it as fruit of the poisonous tree. Workman did not have direct control over the makeshift court’s personnel, but she did select the judge who appointed the temporary chief justice, who then stocked the rest of the bench. As Republicans’ early refusal to comply with the court’s decision illustrates, this absurd process yielded a result that’s easy to dismiss as illegitimate. In all likelihood, we have not yet heard the last word on the impeachment of Margaret Workman.

In its Thursday opinion, the West Virginia Supreme Court bemoaned the current state of affairs. “The greatest fear we should have in this country today is ourselves,” the court wrote. “If we do not stop the infighting, work together, and follow the rules; if we do not use social media for good rather than use it to destroy; then in the process, we will destroy ourselves.” What we are witnessing in West Virginia today is a government destroying itself. It began as a partisan power grab. It may end in the destruction of an entire state judiciary.