Courts, it is often remarked, control neither armies nor treasuries. Their power comes from their legitimacy—by the collective respect won by their credibility and independence. After the bitter, partisan confirmation fight of Supreme Court Justice Brett Kavanaugh, many Americans see that legitimacy as under threat.

Battles for the credibility and independence of the courts have also been taking place at the state level with equal portent and significance, especially in West Virginia, where the Republican legislature has impeached the justices of the state’s supreme court—and in the process has changed control of the high court from Democratic to Republican. A decade ago, the Mountain State foreshadowed the influence that money and politics have come to have on state judiciaries, leading to the enactment of a system for publicly financing court elections. Now the state’s unprecedented impeachment effort may warn of a worrying new trend.

Republicans in Pennsylvania and North Carolina—two swing states with ongoing legal fights over redistricting—have pressured state justices with impeachment. Earlier this year, the Brennan Center for Justice, a nonpartisan policy institute at New York University’s School of Law, documented 16 state legislatures working to diminish their courts’ independence.

Alicia Bannon, a deputy director at the center’s Democracy Program, noted that while these courts often fly under the national radar, they’re nonetheless enormously influential institutions. “Ninety-five percent of all cases are filed in state court. State supreme courts are the final word on state-law issues,” Bannon said. “They can have an extremely powerful role in shaping the legal and policy landscape in a particular state.”

“The fact that this impeachment has been carried out will inevitably have an effect on other states in which legislators or prominent political officials may be considering such threats,” said Douglas Keith, counsel at the Brennan Center. “I think that it puts judges on notice that this is not just an empty threat. This is something that could in fact happen.”

The impeachment drama in West Virginia began with a fairly simple scandal. Early this year, stories broke that supreme-court justices had made lavish renovations to their offices, most conspicuously Republican Allen Loughry, whose updates included a $32,000 blue-suede couch.

Those renovations, and accusations of further improper use of taxpayer funds, soon led to three separate investigations—by a judicial commission, the state legislature, and federal prosecutors—into all five elected justices on the court, which was controlled 3–2 by Democrats.

In June, the court suspended Loughry days before he was arrested by the FBI and charged federally on 22 counts, including lying to the FBI about the renovations and other spending, coaching a potential witness, and fraud.

Even though Loughry, a Republican, was at the center of the allegedly corrupt spending, the state’s Republican legislature seized on the scandal and began a movement to impeach all five justices.

“There is, in my mind, no justification for the impeachment, and it’s such a serious matter that it creates an inference that it is being done for partisan political purposes,” said Robert Bastress, a West Virginia University law professor and state constitutional expert.

As the legislature began impeachment hearings in July, Menis Ketchum, one of the three Democratic justices, retired shortly before federal investigators charged him, too. Soon afterward, the independent judicial commission investigating the office renovations and other spending issues cleared the three other justices:Chief Justice Margaret Workman, a Democrat; Robin Davis, a Democrat; and Beth Walker, a Republican.

Between the commission’s findings and the federal charges, the legislature could have considered the matter settled. But by then—according to Democrats, court watchers, and other political observers—the Republicans had clearly seized on the scandal that began with a Republican justice as a means of taking control of the high court.

And the timing of the legislature’s vote to impeach the four remaining judges (excluding Ketchum, who had retired) raised eyebrows: It came just after midnight on August 14, the exact cutoff point at which the power to replace justices before the November elections moved to the governor, as opposed to voters in a special election.

Justice Davis, a Democrat, announced the morning after the vote that she had retired instead of allowing the legislature to impeach her in a fashion she considered unconstitutional. She dated her letter of retirement a day before the legislature’s vote.

“They have erased the lines of separation between the branches of government,” Davis said, echoing the accusations of Democratic lawmakers. “The majority in the legislature is positioning to impose their own party preferences. The will of the people of West Virginia is being denied. I just cannot allow the finalizing of this plot to come to fruition.”

While a bipartisan group of lawmakers ultimately agreed to remove her from the impeachment process because of her retirement, the Republicans scheduled impeachment trials in the state Senate for the three remaining justices this fall.

Republican Governor Jim Justice, meanwhile, moved swiftly to temporarily replace the two retired Democratic justices with two high-profile Republicans: state Representative Tim Armstead, who served as West Virginia’s first GOP speaker of the House in more than 80 years, and Congressman Evan Jenkins, who had lost the Republican Senate primary in May. Once sworn in, they would have the benefit of running in the November elections as incumbents, a huge advantage.

Suddenly a supreme court that had been controlled 3–2 by Democrats was controlled 3–2 by Republicans. (Chief Justice Workman had named a Democrat to replace Republican Justice Loughry on a short-term basis, pending the outcomes of both his impeachment trial and his federal corruption trial.)

When the justices’ trials began earlier this month in the GOP-led Senate, Republican Beth Walker was acquitted and allowed to keep her job. Shortly thereafter, Workman’s impeachment trial was halted by a special panel of lower-court judges, which ruled in the high court’s stead that her impeachment was unconstitutional and violated the separation of powers.

In the days after, the Senate waged a public fight with the court. Senate President Mitch Carmichael and other Republicans even discussed a Hail Mary appeal to the U.S. Supreme Court—a body that doesn’t rule on state constitutional disputes. Asked about accusations of partisanship, Carmichael told me that “nothing could be further from the truth,” pointing to bipartisan cooperation around Davis’s retirement process.

The battle looks far from over, even as Tuesday’s midterm elections loom. Loughry’s impeachment trial is scheduled for mid-November. Convicted of 11 federal counts earlier this month, the justice is now seeking a new criminal trial, just as Governor Justice is calling on him to resign. Whether after federal sentencing or his impeachment, it looks very likely that the governor will eventually name a replacement justice for Loughry.

And if Armstead and Jenkins, Justice’s two Republican interim appointments on the court, prevail on Election Day, as they are favored to do, the Republicans could soon control the supreme court 4–1.

Whatever happens on Tuesday, though, it won’t be the first time a scandal has remade the West Virginia Supreme Court—or served as a warning sign of political influence on the judiciary.

Before he was convicted of covering up safety violations that killed 29 miners, and before he made headlines this spring with an overtly racistSenate primary bid, Don Blankenship changed how West Virginia dug coal.

zealous pioneer of “mountaintop removal” in the Mountain State, Blankenship spent the 1990s growing his company, Massey Energy, into the nation’s fourth-largest coal producer through an aggressive campaign of consolidation and union-busting. But his legacy isn’t just felt by West Virginians: In the midst of his takeovers, one such fight grew into a supreme-court precedent—and a template for how money and politics now influence judiciaries around the country.

In 1997, Blankenship’s maneuvers pushed a smaller operation into bankruptcy. Its owner, Hugh Caperton, sued Blankenship for fraudulent contract practices, eventually winning a $50 million judgment in 2002. But that was only the beginning. With the case coming up on appeal before the West Virginia Supreme Court, Blankenship brought his coal-baron tactics to the courtroom.

Justice Warren McGraw, up for reelection in 2004, was a coal-country Democrat beloved by union miners and a likely vote against Blankenship in his appeal, which by then had made its way to the supreme court. The state hadn’t elected a Republican to the high court in more than 80 years, so McGraw’s challenger, a little-known GOP lawyer named Brent Benjamin, didn’t seem to have much of a chance. Blankenship decided to change that.

Forming a nonprofit called And for the Sake of the Kids, Blankenship poured more than $3 million into a misleading negative ad campaign. Spanning television spots and billboards around the state, it accused McGraw of taking a “child rapist” out of prison and letting him work at a local school. The actual storyis far more complex, but it was enough to paint the justice as “soft on crime” and “too dangerous for our children.” Bankrolled by the mountain of coal dollars, the ads had unprecedented reach for a judicial race, and McGraw ultimately lost his reelection bid.

Attack ads and big spending aren’t new to politics, but West Virginia had never seen a campaign target a judge like this. Most unusual, though, was the series of events that followed. Three years after Benjamin took his place on the bench, having defeated McGraw at least in part thanks to Blankenship’s attack ads, Blankenship’s appeal of Caperton’s $50 million judgment came before the court, just as expected. Despite a petition that the new justice recuse himself, Benjamin joined a 3–2 vote overturning the original verdict, freeing Blankenship of the multimillion-dollar obligation. Eventually, after a series of appeals and even more controversy over Blankenship’s ties to the bench, Caperton’s challenge made it to the U.S. Supreme Court.

By then, the issue of money in judicial elections was hard to ignore. Blankenship was at the vanguard of campaign cash pouring into supreme-court races after the millennium, from some $80 million in the 1990s to more than double that by 2009. And the risks associated with that spending were becoming apparent: A 2006 New York Times study found that justices on the Ohio Supreme Court voted in favor of their campaign contributors 70 percent of the time. “It’s pretty hard in big-money races not to take care of your friends,” Richard Neely, West Virginia’s former chief justice, told the Times in that story. “It’s very hard not to dance with the one who brung you.”

“There have been a number of state judicial races in the last five years that have cost more than the average race for the United States Senate,” retired Justice Sandra Day O’Connor told the American Bar Association’s Litigation magazine in 2009, as the Supreme Court deliberated Caperton’s suit. O’Connor, the last Supreme Court justice with firsthand experience of judicial elections, had come to see the money “flooding into our courtrooms” as a threat to judges’ independence. Referring to the West Virginia case, she told the magazine, “If I knew that I was litigating before a judge who received that kind of money from my opponent, I would not think I was getting a fair shake.”

The Court’s ruling in Caperton came down early that summer. In a 5–4 decision, Justice Anthony Kennedy—Kavanaugh’s predecessor—sided with the liberal justices and wrote that, as a matter of due process, Benjamin should have recused himself.

The case was a black eye for West Virginia, and it spurred the governor to launch an unprecedented attempt at judicial-election reform. He convened an independent commission, with O’Connor as honorary chair, that recommended a variety of new measures. The state followed through, creating taxpayer-funded elections that now make up the country’s only serious public-financing system for judicial races.

West Virginia could have become a national example for states hoping to stem the influence of money and politics on their courts. But within months of Caperton, the Supreme Court issued another decision that would ultimately undermine those reforms and loosen electoral spending nationwide: Citizens United.

“West Virginia attempted, after the Caperton fiasco, to temper this whole thing by setting up public funding of judicial elections,” Neely said, recalling how quickly the reforms had become obsolete. In the ensuing decade, money kept flowing into West Virginia’s races. By the time Benjamin came up for reelection in 2016, the contest had seen nearly $5 million in spending, with $4.2 million of that going toward TV ads, a new state record. This time, though, it was Benjamin on the receiving end of attack ads. And this time, it was national political groups, not coal, behind the money.

The election was technically nonpartisan, but his main challenger, attorney Beth Walker, had previously run for a seat on the court as a Republican. Eschewing public funds, she received more than $2 million from the Republican State Leadership Committee, the dominant donor in judicial races around the country. Benjamin, using just a half million in public financing, lost.

Once quiet affairs, supreme-court races are now more expensive than ever. “As of January 2017, one-third of all elected justices sitting on the bench had run in at least one $1 million–plus election,” reads a recent Brennan Center report. “Across the country, politicized state supreme court elections are no longer the exception, but the rule.”

Most strikingly, the report found that in 2016, these races experienced a spike in spending of so-called dark money—the post–Citizens United campaign dollars that mask donor information behind shell groups. These funds have become common in national campaigns, but it wasn’t until the last cycle that they became a major factor in supreme-court elections.

This new judicial dark money—which overwhelmingly comes from conservative groups, researchers say—doesn’t just mean less transparency; it also means more firepower on television. According to Emory University Professor Joanna Shepherd, the rise in untraceable campaign money has brought with it a rise in negative TV ads. Nationwide, judicial elections use a template Blankenship helped establish: big-money donors pour millions into an ad campaign that weaponizes a controversial issue to motivate voters.

And, as Blankenship found, the issue that’s often the best motivator is a judge’s ruling on a given criminal case.

“Nobody cares about the way a judge voted in a contract case, but they do care if a judge overturned the conviction of a rapist,” said Shepherd, who has tracked the recent growth in dark money and negative ads. The ads, she noted, are often missing “any sort of nuance or explanation for why a judge voted that way … They fail to mention that there was an illegal search and seizure or something like that.”

Shepherd’s research has found that in the states with the most attack ads, “judges are much more likely to vote harsher in criminal appeals cases,” and much less likely to reduce sentences or overturn convictions. As they get closer to reelection or even reappointment, judges put people in prison longer and send more of them to death row. “The system is forcing judges to act a lot more like politicians than as true judges,” Shepherd said. Experts believe that in the years to come, the growing politicization of state courts could shape how judges rule on other issues, too.

“These are very powerful institutions, and special interests have noticed that, political interests have noticed that, but the public has tended not to pay attention to these courts,” said the Brennan Center’s Alicia Bannon. “They’re not supposed to be political bodies. They’re supposed to be deciding cases based on their understanding of what the law requires. And when you blur the lines between judging and politics, it can be very dangerous for the functioning of our democracy.”

In 1997, the same year Don Blankenship first began his battle with Hugh Caperton, the Notre Dame Law Review published an article titled “Crocodiles in the Bathtub: Maintaining the Independence of State Supreme Courts in an Era of Judicial Politicization.”

Its author, the veteran criminal-defense attorney Gerald Uelmen, had recently achieved fame as a member of O. J. Simpson’s “Dream Team.” Americans remember “If it doesn’t fit, you must acquit” in Johnnie Cochran’s closing argument, but it was Uelmen who’d concocted the line.

His article began:

The late Honorable Otto Kaus, who served on the California Supreme Court from 1980 through 1985, used a marvelous metaphor to describe the dilemma of deciding controversial cases while facing reelection. He said it was like finding a crocodile in your bathtub when you go in to shave in the morning. You know it’s there, and you try not to think about it, but it’s hard to think about much else while you’re shaving.

The crocodiles he had in mind were the typical cases to reach public notoriety: criminal trials, most notably death-penalty ones. As money and politics have infected judicial elections, he says, judges have begun to see more crocodiles in more bathtubs.

“Judges are subject to a lot more pressures, and the whole crocodile-in-the-bathtub thing with respect to judicial elections [has], I think, gotten much more serious,” said Uelmen, who’s now a retired dean of the Santa Clara Law School in California. “Since I wrote that article, the necessity for judges to engage in political campaign activity has really increased. There is much more targeting of judges in judicial elections.”

The crocodile isn’t just about big-money backlash to individual cases; fundamentally, the anxiety is one of job security. And as the impeachment saga in West Virginia shows, judges’ jobs are no longer just at risk during election season. Indeed, Shepherd said, “there’s a threat all the time.

“In the past, maybe it was only death-penalty cases or very politically salient cases that you had to worry about how the public would respond,” she continued. “Now you have to worry about an entirely new range of cases as well that other political leaders may care about.”

Calls for judicial impeachment are not entirely new. Whenever the judiciary has weighed partisan issues, politicians have flirted with these threats. Before the issue was litigated at the Supreme Court, state decisions on same-sex marriage led to judicial-impeachment bills in Massachusetts, Iowa, and New Jersey. Recent impeachment threats in Pennsylvania and North Carolina, among others, emerged from redistricting fights in those states.

But in West Virginia, legislators are pursuing impeachment without a single divisive issue in play. The Brennan Center’s Keith pointed to broader changes in American politics as an explanation for the multiple impeachment calls this year. “I think it is difficult to separate what is happening in the states from the increased willingness of prominent political figures—the president included—to attack judges in ways that we haven’t seen political officials attack judges in the past,” he said. “I think that behavior gives the green light to lower-level political officials to do the same thing. And then when you see these threats actually being carried out in one state, it puts judges on notice that this is not just rhetoric. It may, in fact, be action in the future.”

While Republicans dominate legislative efforts to shape judiciaries around the country, forces on the left have also raised concerns for jurists. Uelmen sees his home state of California as a battleground over judicial independence, describing the Golden State’s use of direct democracy as its particular crocodile in the bathtub: Ballot initiatives force the state’s supreme court to weigh the constitutionality of the people’s will, not just the writings of Sacramento lawmakers. And just recently, the state saw its first judicial recall since 1932 when Judge Aaron Persky, who issued the controversial ruling in the rape trial of the former Stanford University swimmer Brock Turner, fell to a removal effort by progressive activists.

“I’ve heard from judges in our own county in the wake of the Turner case that many of them are reluctant to take on cases that involve any sort of public controversy,” Uelmen said. “To a certain extent, a judge can recuse himself and say, ‘I just don’t want to go anywhere near this case.’ And then judges are going to be few and far between who are going to be willing to stick their neck out.”

American court systems have always been torn between independence and accountability, and maintaining that accountability through elections has always polled well. But history also shows the value of isolating judges from politics. The landmark 1954 Brown v. Board of Education decision would not have been possible if the justices had followed popular opinion around segregation. After the ruling, IMPEACH EARL WARREN signs cropped up all across the South.

Calls for Kavanaugh’s impeachment—though based on accusations of sexual misconduct and perjury rather than his rulings—are sure to only grow if Democrats take the House in November. And in a strange twist of fate, the West Virginia debacle would be among his first cases if it came before the Supreme Court. For now, however, it’s not apparent what grounds the West Virginia legislature has for federal appeal, likely leaving the final word on the impeachments with the state’s voters in November.

The national impact of this episode, however, may not unfold as quickly. A decade ago, West Virginia was the canary in the coal mine for a world in which judges behave more like politicians. Now its impeachment drama could portend a future where state judges feel their jobs are constantly at risk.

It’s easy to feel numb these days to yet another shifting norm. Even as Americans focus on national politics, the changes under way on the federal bench are often overlooked. And as those changes shift the nation’s legal battles to even-less-scrutinized state courts, these powerful judiciaries may soon see a new level of influence—and a new kind of attention.