The most expensive House race in history ended in a win for Republicans as Karen Handel narrowly defeated Democrat Jon Ossoff in the special election for Georgia’s traditionally red 6th district.

Ossoff and Handel collectively raised a whopping $56.7 million, according to the Center for Responsible Politics, for a race that was widely seen as a referendum on Donald Trump’s presidency.

Though Georgia’s 6th district, which includes the suburbs of Atlanta, is a traditionally conservative area, Ossoff’s loss is still crushing for Democrats, who have so far been unable to translate anti-Trump sentiment into tangible political gains, including in two other close special elections in deep-red Kansas and Montana districts. But Ossoff’s loss is made worse by the money involved — $24 million from the party and another $8 million from outside groups.

The race was still close enough that Republican officials spent the last few weeks white-knuckled. Not only did Oklahoma’s Rep. Tom Cole openly admit that the race was a “referendum on Trump,” but administration officials were reportedly unnerved by the amount of time and money they had to throw at a district held by the right for almost four decades. After Ossoff nearly took the district outright in its April primary, outside super PACs quickly stepped in to back up Handel. As of Monday, outside groups had spent a whopping $18 million backing her and attacking Ossoff.

Ossoff’s popularity in the district, which Trump carried by only two points, was encouraging to Democratic donors, who saw an opportunity to take back a seat before the midterm elections. In fact, the majority of Ossoff’s money came from small donors — 65 percent from donations of $200 or less, according to the Center for Responsive Politics.

Even Tom Price, who represented the district until Trump tapped him to head the Department of Health and Human Services, said he was shocked by the amount of outside influence involved in the race. “The out-of-state money is crazy,” Price remarked to Handel supporters during a rally.

But despite the influx of donations, Handel — whose traditionally conservative campaign was endorsed by both President Trump and Vice President Mike Pence — ultimately did better than some on the right had feared.

Still, Ben Ray Luján, the chairman of the Democratic Congressional Campaign Committee, which spent about $5 million on the race, pointed out that Ossoff “vastly outperform[ed]” past Democrats who tried to take the district.

“There are more than 70 districts more favorable to Democrats than this deep-red district, and Ossoff’s close margin demonstrates the potential for us to compete deep into the battlefield,” Luján said in a statement. “The strong headwinds facing Republicans, incredible grassroots enthusiasm behind Democrats, and a damaged and exposed House Republican Caucus all clarify that we have the momentum heading into 2018.”

Some other takeaways from the election: