North Carolina Republicans are not having much luck in court. Already this year, the U.S. Supreme Court has struck down state legislative districts and federal congressional districts drawn by the North Carolina GOP as unconstitutional racial gerrymanders. State courts have also blocked key portions of Republicans’ legislative power-grab, including an election board overhaul that would’ve prevented Democratic Gov. Roy Cooper from restoring voting rights throughout the state. A federal court had previously invalidated a different disenfranchisement bill, writing that Republican state legislators had “target[ed] African Americans with almost surgical precision.”

The state GOP has not modified its strategy in response to these rulings. Instead, it’s trying to modify the courts. North Carolina’s Republican-dominated General Assembly is currently poised to pass a gerrymandering bill that would carve up state judicial districts to create more seats for GOP judges and fewer seats for Democratic ones. The measure would not merely politicize the courts. It would transform them into another political branch designed to do the bidding of legislative Republicans. If the assembly’s gambit succeeds, North Carolina’s judiciary may permanently lose its independence.

Republicans began tampering with the judiciary shortly after the 2016 election, in which Cooper prevailed in the governor’s race and Democrat Mike Morgan won a seat on the state Supreme Court, a victory that gave progressive justices a 4–3 majority. Many Republicans were convinced Morgan triumphed only because the judicial race was officially nonpartisan. They responded by making state Supreme Court elections partisan and later added a requirement that lower court candidates list their political affiliations. GOP legislators also allowed the full state Court of Appeals—on which Republicans held a majority—to hear cases before they reached the state Supreme Court. Several Republican judges on the Court of Appeals were set to retire during Cooper’s tenure due to age limits, so the assembly shrank the court to prevent Cooper from replacing them.

Against this backdrop, state courts heard challenges to a series of bills passed by Republicans just before Cooper took office that diminished the power of the governor. The most dramatic measure restructured the state election board, as well as all 100 county election boards, to preclude Democrats from reforming state elections. Under the old system, the state election board consisted of five members: three from the governor’s party and two from the minority party. Each county board was made of three members: two from the governor’s party and one from the minority party. These boards set voting procedures, oversaw voter registration, set poll locations, and maintained voter rolls. Republicans used them to slash early voting and purge voters, especially minorities, from the rolls. Once they took control of the boards, Democrats planned to reverse this suppression.

The General Assembly’s Republicans thwarted this plan in two ways. First, they created a “New State Board” with eight members. The governor and the assembly would each select four members, and the board would need six votes to take action. A Republican would chair the board in election years, while a Democrat would chair it in off-years. Second, GOP legislators altered the county boards so that each would include two Democrats and two Republicans, and require three votes to act. These redesigns would cause perpetual deadlocks on both the state and county boards, barring Democrats from enacting their planned reforms.

In March, a three-judge Superior Court—which included two Democrats—unanimously blocked this overhaul as a violation of the separation of powers guaranteed under the state constitution. Republican leaders in the General Assembly threatened the three judges, hinting that their “blatant overstep” would have “profound consequences” and demanding that they either “hang up their robes” or “reverse their order.” The intimidation worked. When Republicans tinkered with the law and passed it again, the same judges declined to strike it down, a contradiction of their previous decision that is plainly a consequence of legislative harassment. The state Supreme Court is now mulling the law’s constitutionality.

Following this episode, legislative Republicans seem to have decided that a direct assault on the state judiciary would be more efficient than a periodic bullying and reshuffling of the courts. They have already passed a bill that will eliminate judicial primaries—an attempt to introduce chaos into judicial elections in the hopes that more Republicans can eke out wins. (Cooper rejected the measure, but the Republicans’ legislative supermajority will soon override his veto.) Within the next few weeks, GOP legislators are also expected to pass a judicial gerrymander, completing their siege on the current court system.

The gerrymander will create new judicial districts in majority-white, Republican-leaning rural and suburban regions. It will simultaneously shrink the number of judicial districts that cover more diverse, Democratic-leaning urban areas. The bill slices up some districts and combines others so that many Democratic incumbents will have to run against each other. The Asheville Citizen-Times provides one vivid example. Currently, Buncombe County elects nine judges in countywide election; all are Democrats. The new system would create two judicial districts: a Republican-heavy district that would elect five judges and a Democratic-heavy district that would elect four. Thus, although the country is strongly Democratic, it would almost certainly elect a majority of Republican judges. The bill uses similar tactics to guarantee Republican judicial majorities in the state’s other Democratic-leaning counties.

Southern states have a long history of gerrymandering judicial districts to dilute black votes that continues to this day. In defending this gerrymander, Republican state Rep. Sarah Stevens declared that until counties are carved up, “the heart of the city controls who all the judges are. … People in the more suburban areas really can’t run or don’t get a chance.” That’s actually not true; a majority of Buncombe County’s judges, for instance, live in rural or suburban areas. What Stevens really means is that white Republican voters are a minority in some counties and thus unable to elect their preferred candidates through democratic means. The General Assembly is therefore manipulating the map to ensure that a minority of voters can select a majority of judges.

As with all political gerrymanders, this partisan distortion of elections obviously contravenes basic democratic values. But more disturbingly, it represents a flagrant attempt by the legislature—which is itself unlawfully gerrymandered—to bring the judiciary to heel. GOP leaders have already pressured one court into effectively reversing its ruling. Now they are restructuring the courts to hand Republican judges an unearned advantage, with the expectation that these allies sign off on future power-grabs. Instead of playing by the rules, Republican legislators are replacing the referees. To maintain a well-functioning democracy, every state needs a robust and independent judiciary. Soon, North Carolina may have neither.