Shortly after Barack Obama’s victory in the 2008 presidential election, the former chair of the North Carolina Republican party wrote an anxious postmortem saying something had to be done about the students and black voters whose unprecedented turnout had turned the state blue for the first time in 32 years.

The alternative, the former state chair Jack Hawke wrote, was that the country would “continue to slide toward socialism”.

That “something” turned out to be a notorious omnibus law – better known to its detractors as the “monster law” – passed by a Republican-majority state legislature in 2013. The legislation gutted many of the progressive voting rules that had contributed to Obama’s razor-thin margin in the state: same-day registration, a lengthy early voting period and out-of-precinct voting by provisional ballot – all favored disproportionately by African American voters and students. The law also introduced a strict voter ID requirement, with the anticipated effect of suppressing Democratic votes even further.

Had the law stood, it could have been the biggest setback for voting rights in North Carolina since the Jim Crow era, a brazen attempt by conservatives to upend the rules of democratic engagement and block access to groups most likely to oppose them. The Republicans have sought to couch their maneuvering in more benign terms, as a form of justifiable partisan warfare. Hawke noted in his postmortem that the Democrats had been motivated, united and well-financed in 2008, and said it was up to the Republicans to respond in kind.

That argument has come crashing down, following a flurry of remarkable court rulings over the past two weeks accusing North Carolina and three other Republican-run states – Wisconsin, Kansas and Texas – of violating the 1965 Voting Rights Act and intentionally discriminating against African Americans and other classes of voters. State and federal judges have struck down laws that could have given the Republicans a significant edge in close races this November, lifting the spirits of voting rights activists who have been campaigning against such laws for more than a decade.

Winning an election does not empower anyone in any party to engage in purposeful racial discrimination Fourth circuit court of appeals ruling

“Winning an election does not empower anyone in any party to engage in purposeful racial discrimination,” the fourth circuit court of appeals ruled in the North Carolina case on Friday. “When a legislature dominated by one party has dismantled barriers to African American access to the franchise, even if done to gain votes, ‘politics as usual’ does not allow a legislature dominated by the other party to re-erect those barriers.”

The omnibus law has been almost entirely swept away and is now unlikely to be resurrected in any form before November, when Hillary Clinton and Donald Trump will be fighting over every vote in North Carolina, where recent polls show them less than two points apart.

In Kansas, which is not a swing state, a state court pushed back against an attempt by the state’s top Republican elections official, Kris Kobach, to prevent an estimated 17,500 Kansans from voting in state and local races even though they have been recognized as eligible by federal courts. They will now be allowed to participate fully in primary elections this Tuesday.

In Texas, also not a swing state, a federal appeals court has ordered the state government to find a remedy for eligible voters unable to comply with the country’s single most restrictive and blatantly partisan voter ID law – a law recognizing concealed-carry weapons permits as valid ID but not student cards from state universities.

And in Wisconsin, which is a swing state, the federal courts have delivered a double rebuke to Governor Scott Walker and his contention that one of the country’s most efficiently run election systems was in need of a major overhaul. One federal judge ruled last week that eligible voters unable to meet the requirements of the state’s voter ID law could instead produce an affidavit attesting to their identity. On Friday, a different federal judge struck down much of Wisconsin’s version of the North Carolina omnibus law – a 2013 act that restricted early voting, extended the residency requirement for new voters and denied provisional voters the chance to vote out of precinct.

“The legislature’s immediate goal was to achieve a partisan objective,” Judge James Peterson charged in a blistering ruling, “but the means of achieving that objective was to suppress the reliably Democratic vote of Milwaukee’s African Americans.”

‘The tide is turning’

Taken together, these rulings represent a stunning rejection of more than a decade of Republican strategy in states where the party has taken control of the legislature, the governor’s mansion or both.

“The tide is turning against the proponents of voter suppression across our country,” longtime voting rights activist Kirsten Clarke, of the Lawyers’ Committee for Civil Rights Under Law, said in a statement. “It is time for elected officials to see the writing on the wall and abandon efforts to lock Americans out of the ballot box.”

Bob Phillips of Common Cause North Carolina was similarly jubilant. “This is a big win,” he said after the fourth circuit ruling. “It affirms that democracy is for everyone.”

Republican leaders were either too stunned to offer an immediate response, or else accused “activist” judges of making an incorrect interpretation of the law. Despite the GOP’s protestations that it is championing “commonsense” safeguards against fraud, most political analysts agree that turnout has been a preoccupation. As demographic trends move away from the GOP’s overwhelmingly white base, it has become obvious over several election cycles that the fewer voters come to the polls, the better the party tends to do.

Numerous studies, including one by the Government Accountability Office, have shown that voter ID laws can shave two to three percentage points off Democratic turnout – a margin that can easily swing a race for the House, the Senate or the presidency.

Peterson was unable to throw out Wisconsin’s voter ID provision entirely because it was upheld by the higher federal courts in 2014, just as Indiana’s was a few years earlier. Plenty of other obstacles to voter registration and participation remain, for example in Florida where third-party registration drives have all but ceased because of a Republican-backed law passed in 2011.

In other words, not every obstacle to voting will be removed across the country before November, but the latest rulings nevertheless make life more difficult for the Trump campaign, especially if the race remains close and states like Wisconsin and North Carolina prove crucial to his chances.

The judicial decisions are also likely to affect down-ticket races – for example, in the west Texas congressional district where the former Democratic representative Pete Gallego lost his seat by about 2,000 votes in 2014 and now stands a much better chance of winning it back. One academic study suggested he lost 10,000-15,000 votes because of the impact of the voter ID law.

Folks are not going to put their guard down. We and others will continue to double down on education Bob Phillips, Common Cause North Carolina

Bound up in the battle for voting rights is a bigger ideological fight, over the legacy of racism in America and the continuing need for legislation to protect certain minorities. Before 2013, when the supreme court gutted a key provision of the Voting Rights Act, North Carolina and Texas would not have been able to pass their repressive voting laws because they would have been blocked by the justice department’s civil rights division.

At the time, the supreme court’s chief justice, John Roberts, argued that policing of racism in elections should be determined by “current conditions” and that, in his view, discrimination did meet the “pervasive, flagrant, widespread and rampant” level that had justified the Voting Rights Act in the 1960s.

That view was sharply contested by Ruth Bader Ginsburg, among others, and by the rank and file of the North Carolina NAACP, which reacted to the omnibus law by staging weekly protests in the streets known as “Moral Mondays”. The Rev William Barber, the head of the North Carolina NAACP, who had a prominent speaking slot at last week’s Democratic national convention, has described the battle against the new voting laws as “our Selma”.

Now it seems likely that both the voter ID question and the related question of voter discrimination will come back to the supreme court, at which point Roberts will have to decide whether “current conditions” are as upbeat as he assumed in 2013.

In the meantime, voting rights activists in North Carolina and other states will be keeping a hawk eye out for further attempts to restrict voting through disinformation or other time-honored means.

“Folks are not going to put their guard down,” said Phillips, of Common Cause. “We and others will continue to double down on education to make sure there’s no confusion. Whatever the folks pushed these laws through try to say from here on to Election Day, we will make sure it’s accurate, not misleading.”