This has not exactly been a stellar year for democracy in America. But we have also seen some heartening victories for one of democracy’s core tenets: the right to vote. Over the last month, one federal court after another has struck down attempts by Republican legislatures to suppress the votes of racial minorities. Coming three years after the Supreme Court cut out the heart of the Voting Rights Act in the landmark decision Shelby County v. Holder, and less than a decade after the court tentatively upheld voter ID laws, this represents a remarkable turnaround.

The aggressiveness federal courts have shown in protecting the right to vote is, in part, a result of the new legal landscape created by the death of Justice Antonin Scalia. But it is also a reaction to egregious overreach by Republican legislators desperate to preserve their hold on power in the face of increasingly unfavorable demographics. This overreach may well cost them a particularly important vote on the high court: that of its lone moderate conservative, Anthony Kennedy.

To put the recent string of voting rights victories in perspective, it’s worth stepping back to the 2008 case Crawford v. Marion County Election Board. In that case, the Court upheld Indiana’s voter ID requirement, in an opinion that—surprisingly—was written by the great liberal Justice John Paul Stevens. The law required voters to show a valid Indiana photo ID, which critics said would disproportionately affect poor minority voters who generally vote Democratic.

It is becoming apparent, however, that Stevens’s plurality opinion was a masterful chess move. While the concurrence written by Scalia urged the Supreme Court to be very deferential to state election laws, Stevens’s qualified opinion said only that the Indiana law had not been proven to be discriminatory on its face, preserving the possibility that other similar statutes could be shown to be unconstitutional.

Stevens allowed the fight for voting rights to live for another day, and this turned out to be crucial. Lower federal courts retained the ability to find that particular statutes were illegal—and in the last year they repeatedly have.

The cases of the past month were remarkable for different reasons. The Fourth Circuit Court of Appeal’s decision striking down North Carolina’s particularly draconian voter suppression law found that the statute was intentionally discriminatory. This is normally a difficult standard to meet, but given the facts, Judge Diana Motz had little difficulty reaching her conclusion. The day after the Shelby decision held that the state was not required to clear changes to its election laws with the Department of Justice, the North Carolina legislature requested race-based voting data. It proceeded to target African-American voters with, as Judge Motz put it, “almost surgical precision,” enacting five different measures that made it more difficult for them to vote.

Most of these changes—such as eliminating Sunday voting and reducing the time period for early voting—didn’t even pretend to have any electoral integrity, in contrast to voter ID laws, which are ostensibly about countering the nearly nonexistent problem of voter fraud. The only way North Carolina Republicans could have been more blatantly discriminatory would have been to show up at the ballot wearing white sheets, and a unanimous Fourth Circuit panel refused to look the other way.

The Fifth Circuit’s decision earlier in July striking down significant parts of a similar Texas law was also significant. This decision was more circumspect, declining to come down on whether the law was motivated by discrimination. Instead, it focused solely on whether the law disproportionately affected the ability of racial minorities to vote, in violation of Section 2 of the Voting Rights Act. The court concluded, based on overwhelming evidence, that the law did have an illegal disparate impact, since racial minorities were more likely not to have the required ID and furthermore would have a harder time obtaining it.

What’s striking about this decision is that the Fifth Circuit remains a conservative court with a majority of Republican nominees. Texas’s law was so egregious it couldn’t survive even the circuit court venue most favorable to Republicans. What this indicates is that legislatures like North Carolina, Texas, and Wisconsin have overreached. In the wake of Crawford, states could probably have continued to get away with more subtle forms of suppression. But omnibus bills that made a mockery of Chief Justice John Roberts’s blithe assertion in Shelby County that racial discrimination in voting was no longer an issue—and that therefore Congress had lost some of its explicit constitutional authority to address it—are another story.

When states passed these laws the Supreme Court that decided Shelby County was still in place, and Republican decision-makers surely expected the laws to survive Supreme Court review no matter what happened in lower courts. Scalia’s death, however, changed everything. There is no chance of a Supreme Court majority to overrule any of these decisions. And in light of the Fifth Circuit’s decision, there’s a real possibility that even with an eight-person Court there might be an outright majority to sustain them.

But this kind of overreach could have even broader consequences. Earlier this year, Anthony Kennedy voted to strike down an abortion regulation for the first time since 1992, presumably reacting to what he perceived as overreach by the Texas legislature. It’s possible that something similar will happen with voting rights. Kennedy seems to be increasingly dubious about the direction the Republican Party has taken, notably on race. In the same week he became the swing vote to strike down Texas’s anti-abortion law, he voted to uphold the state’s university affirmative action program, the first time he had ever found an affirmative action program constitutional.

Perhaps even more importantly, last year Kennedy provided a fifth vote to hold that the Fair Housing Act allows courts to consider disparate impact on racial minorities (as opposed to being limited to intentional discrimination, which is much more difficult to prove). The case suggested that he’s likely to take a dim view of the ambitious vote suppression schemes Republican legislatures keep passing.

Of course, if Hillary Clinton wins the election and can get a replacement for Scalia confirmed, Kennedy’s vote will be moot. Not only would this mean five certain votes to strike down attacks on voting, but also that the outrageous Shelby County decision would almost certainly be overruled as soon as an appropriate case comes to the Court. If Hillary Clinton defeats Donald Trump and Republicans fail to hold the Senate, it’s going to be much harder for the party that nominated Trump to retain power by keeping racial minorities from the polls.