Virginia’s elections on Tuesday night were a stinging loss for the Republican Party. Governor-elect Ralph Northam won by the biggest margin for a Democratic gubernatorial candidate since 1985, and Democrats made massive and unexpected gains in the House of Delegates.

Election night was also very difficult for the National Rifle Association, which is headquartered in Fairfax, Virginia, and spent big bucks in an effort to defeat Northam and several other Democrats who ultimately won. The NRA poured over $2 million into races in Virginia, including a massive $750,000 advertising push in the last three weeks before the election.

The losses came up and down the ticket. Northam, Lieutenant Governor–elect Justin Fairfax, and Attorney General Mark Herring all faced NRA-backed candidates and won. In 13 competitive races where the Democratic candidate was endorsed by the pro–gun control group Giffords (until recently known as Americans for Responsible Solutions) and the Republican was backed by the NRA, the Giffords candidate was victorious in 12. The winner of the 13th race still hasn’t been declared, as Democrat Shelly Simonds and Republican David Yancey await a full vote tally. Among the winners was Chris Hurst, whose girlfriend was fatally shot on the air as she reported for a local Virginia television station. His opponent was backed by the NRA.

Other gun-control groups like Moms Demand Action and Everytown also pushed hard for these pro–gun control Democrats—Everytown dumped $700,000 into Virginia races as election day drew near.

NRA candidates in very safe Republican districts still won, but that was to be expected. In short, the NRA got its clock cleaned everywhere that mattered.

Since the NRA frequently gets involved in competitive federal and state races nationwide, almost always on behalf of Republican candidates, naturally sometimes its candidates win and sometimes they lose. There can be a tendency to over-read these results—if a race didn’t meaningfully turn on gun control, it probably didn’t tell us much about gun politics. But that was clearly not the case in Virginia.

Northam, who boasted about his F rating from the NRA, protested outside NRA headquarters in Fairfax after the Las Vegas shooting that claimed 58 lives and injured 546 others. “I appreciate it when someone says, ‘Our thoughts and prayers are with you.’ But it’s time to take it a step further; we need to take action,” he said.

His running mates were equally aggressive in going after the NRA. “Each one of us is very proud of our F,” Fairfax said.

Mark Herring, who was reelected as attorney general Tuesday, had a particularly combative relationship with the NRA. Virginia had concealed-carry reciprocity agreements with 30 states until 2015 when Herring announced he was cutting the agreements with 25 of those states, citing permit policies that were too lax. This outraged the NRA and other gun-control groups, and ultimately Herring’s move was reversed by Virginia’s Democratic governor, Terry McAuliffe, who signed a bill that reinstated the agreements with those 25 states but instituted “voluntary” background checks at gun shows, along with heightened enforcement from state police. (Gun-control groups bashed McAuliffe for the move, and Herring refused to attend the bill’s signing.)

Voters understood that gun control was a big issue in the race. Seventeen percent of voters listed “gun policy” as their most important issue, which was second only to health care. Those voters split evenly between Northam and Gillespie, which cuts against the conventional wisdom that pro-gun voters tend to prioritize the issue to a much greater extent than people who favor gun control. “The narrowing of this enthusiasm gap portends greater losses for candidates that strictly adhere to the gun lobby’s agenda,” said Peter Ambler, executive director of Giffords, in a post-election memo.

Legislators at the federal level noted the results too, like Senator Chris Murphy, one of the leading gun-control champions in the Senate:

The story of the Virginia elections is that, while Gillespie outperformed several past statewide Republicans in conservative, rural areas, he got absolutely clobbered in Virginia’s suburbs. There were many reasons for this, but it tracks with the long-running belief by gun-control advocates that the issue plays big-time in suburban areas, particularly with women. Republicans seem to be catching on to this fact—when post–Las Vegas legislation to ban “bump stocks” was introduced in the House last month, it had 15 Republican co-sponsors, all of whom were from vulnerable districts, many of them in suburban areas. Gillespie boasted of his NRA endorsement, but didn’t actually release his responses to the NRA’s issue questionnaire.

There are some caveats to these results, namely that two high-profile mass shootings happened in the run-up to the election. Voters tend to react strongly to such shootings but then quickly lose interest in gun control, which they may not have had a chance to do between the Las Vegas shooting and Sunday’s attack in a church in Sutherland, Texas, which killed 26 people, and Tuesday’s voting. But, that said, every bit of data about Tuesday seems to be pointing in one direction: Pro-gun Republicans in anything but a safe district should be very worried.