SANDY SPRINGS, Georgia — Democrat Jon Ossoff ran a campaign with unprecedented support from national grassroots donors, faced an opponent with a controversial history at a popular charity, and managed to escape a turbulent six-month race relatively scandal-free.

It wasn’t enough.

On Tuesday night, Republican Karen Handel carried Georgia’s Sixth Congressional District. The race was called for her by the DecisionDesk and Dave Wasserman of the Cook Political Report at a little before 10 pm, as well as by CNN.

Democrats will spin Tuesday night’s loss as a product of the Georgia Sixth’s historically Republican leaning. They’ll note that former Rep. Tom Price won the seat by more than 20 points this fall, and that Democrats haven’t held the seat for several decades. All of that is true.

But a basic fact of the race — which its Republican voting history doesn’t negate — is that this was a district that looked prepared to revolt against President Donald Trump. Hillary Clinton only lost the district by one point in 2016, and voters here supported Marco Rubio and Ted Cruz in the Republican primary. Ossoff was ahead in polling at times, and was supposed to benefit from an upsurge in turnout from an energized liberal voter base and massive canvassing operation. In the first round of voting this April, Ossoff came within a few points of clearing the 50 points he needed to avoid Tuesday’s runoff.

What the Georgia special election shows is that House and Senate Republicans still have powerful tools for beating back Democratic challengers, including appeals to an in-group identity and an avalanche of dark-money attack ads.

Democrats overperformed — but they should still worry for 2018

Democrats would need to flip 24 seats this fall to take back the House. Currently, Republicans hold 26 districts where Clinton did better than she did in Georgia’s Sixth Congressional District.

Those 26 districts are going to be what the party looks at as its prime pickup opportunities. But if the Georgia election is a sign of what’s to come in the fall of 2018 — and that is assuming a lot — it’s not a great sign for Democrats’ hopes to take back the House. In that case, Democrats could only lose two of 26 congressional districts where Clinton did better than Trump and take back the House.

Beyond what it says about the map, the outcome may itself shape the kinds of candidates Democrats can field in 2018. Political scientists had argued that an Ossoff win could help change that. Victories in the special elections are seen as encouraging better Democratic candidates to throw their hats into the ring. “If the general feeling is that it represents a warning sign for Republicans, that has strong implications for whether Democratic candidates jump in for 2018,” said Dave Hopkins, a Boston College political scientist, in an interview about special elections earlier this year. “There’s a self-fulfilling prophecy here, as incumbents consider retirement thinking they’ll face a tough race, which in turn makes the field tougher for Republicans.”

In 2016, House Democrats didn’t just face the obstacle of gerrymandering when going up against the GOP. They also ran a slew of extraordinarily weak candidates in red but achievable districts, including someone who had been unemployed for the past six years and a beekeeper with no elected experience. Republicans have won three special elections in a row — in Kansas, Montana, and now Georgia — which will likely help their party’s recruitment, and hurt Democrats’.

Handel successfully criticized Ossoff as “not one of us.” So will other Republicans

Throughout the election, Ossoff tried running as a moderate, pro-growth centrist Democrat. He stressed his economic moderation, distanced himself from Nancy Pelosi, and rejected core lefty policy demands like single-payer health care out of hand.

But even as he ran as an economic moderate, Ossoff defended diversity and multiculturalism, vowing to strongly defend voting rights for African Americans; running endorsements from Khizr Khan, the Muslim Gold Star father who took on Trump; and declaring the he will “never shy away from standing with the LGBT community, publicly, forcefully, with everything I’ve got.”

Handel weaponized Ossoff’s otherness against him. “The people of the Sixth, you actually want someone who lives in this district; you want one of your neighbors,” she told supporters at the Cherokee Cattle Company in Marietta on Tuesday. Ads blitzed the airwaves saying of Ossoff, “He’s just not one of us.”

Someone sent the Washington Post’s David Weigel a bunch of Handel’s direct mailers in the district. In a post titled “All politics is tribal,” Weigel noted that many of them attacked Ossoff for his work as a documentarian overseas:

Handel's campaign wanted veterans to resent Ossoff because he was a media producer and journalist, not one of them. The ad strategy, and the campaign visit from Republicans such as House Speaker Paul Ryan, have had almost nothing to say about what Republicans were working on in Washington. The message was that Republicans would feel terrible if they had to watch Democrats celebrate. It was negative polarization on a micro scale — and, whatever happens, it kept Handel in the fight. It brought Bikers for Trump to Georgia to get out votes because, whatever she stood for, a Handel win would help Trump.

In this election, one of the most common recurring debates is over whether Ossoff can claim to live in the district he’s running to represent. Handel continued to make the point that Ossoff resides just outside the Sixth’s boundaries. Then, on cue, Ossoff retorted that he did grow up within its boundaries but has temporarily moved outside of it to support his fiancée as she completes medical school.

The back and forth has gotten a lot of play in the press, but it obscures a larger point. Handel’s attack was useful because it allowed her to insinuate something else entirely — that Ossoff doesn’t belong to the traditional community of the area in a much more fundamental sense.

It worked.

An unprecedented spending glut shaped the race

It’s a little staggering to take a minute to reflect on how much money from outside Georgia’s Sixth Congressional District was spent to choose its House representative. More than $55 million wound up being spent on the race by the candidates and outside groups combined, according to the New York Times.

But it’s worth viewing the numbers in the context of 2018. Ossoff shattered fundraising totals by raising more than $23 million, according to the Atlanta Journal-Constitution. Aided by national liberal groups like the Daily Kos and ActBlue, Ossoff received money from more than 200,000 small-dollar donors across the country.

But Ossoff was able to shatter fundraising records in part because his election was one of a tiny number going on right now, at a time when Democrats are particularly furious over Trump. Nobody knows if the hundreds of House Democratic candidates can rely on such an outpouring in 2018.

And Handel almost totally neutralized it. Crushing the grassroots donor surge from across the country, she benefited from out-of-state groups tied to private industry. Ossoff received $22 million, but outside groups spent $18 million for Handel. The US Chamber of Commerce, Donald Trump, and the National Republican Congressional Committee have all directly raised money for Handel’s campaign, which may in turn be used to fund the anti–outside money attacks.

Moreover, Handel has been helped by groups like the Congressional Leadership Fund, closely associated with Speaker Paul Ryan, which spent $2 million on the race. Not only are CLF’s donors outside Georgia’s Sixth, but campaign finance experts can’t even find its funders because the groups that are funding it do not have to disclose their donors.

Some Democrats like Ossoff may get lucky and again catch fire with the grassroots donor base in 2018. But even if they do, Republicans are likely to have private industry to bury them in a mountain of cash.