Republicans in North Carolina changed election laws to try to rig the state Supreme Court in their favor. It might not work out the way they planned.

The North Carolina Republican Party’s plan to tip the scales in a judicial race in 2018 appears to have backfired. Under their own new laws, the odds have actually increased that Republicans will lose an upcoming state Supreme Court election.

After losing their majority on the state high court in 2016, the GOP supermajority in the North Carolina General Assembly passed sweeping laws that critics argued were a ploy to prevent more liberals from winning.

The changes eliminated partisan primaries, forcing all candidates to run together on one ballot. As Slate notes, Republicans theorized Democrats would run multiple candidates against Republican incumbent Barbara Jackson, increasing the likelihood Democrats would split their vote and tilt the odds in the GOP’s favor.

Instead, the opposite happened. Just before the deadline, a second Republican, Raleigh attorney Chris Anglin, filed to run. And only one Democrat is in the race: civil rights lawyer Anita Earls.

Earls, a former official in the Clinton Justice Department and the founder of the Southern Coalition for Social Justice, is running on a progressive platform of protecting civil rights and voting rights. She also led lawsuits challenging the GOP’s gerrymandering and voter suppression schemes.

After Earls’ candidacy was announced, North Carolina Republicans even went out of their way to make sure candidates whose surnames begin with “E” will appear last on the ballot.

Now, with Earls the sole Democrat running against the two Republicans competing for GOP votes, her chances of winning have improved.

“[T]hat will dilute the vote among Republicans,” said GOP consultant Paul Schumaker. North Carolina GOP Executive Director Dallas Woodhouse took a sharper tack, saying that Anglin — who was a registered Democrat until recently — “will be treated like the enemy he is.”

In recent years, North Carolina Republicans have employed heavy-handed tactics in order to cling to power. They have engaged in extreme gerrymandering and passed voting laws that a federal court found target African-Americans “with almost surgical precision.” The GOP-controlled legislature also tried to pass laws stripping Democratic Gov. Roy Cooper of several executive powers — which a state court found unconstitutional.

Now, the GOP’s attempt to rig election laws in their favor could end up costing them in November.