MADISON, Wis. (AP) — Conservative Brian Hagedorn’s strong showing in Wisconsin’s Supreme Court race cheered state Republicans Wednesday, with their first positive result in a statewide election since 2016 suggesting reasons for optimism next year in a critical presidential battleground.

Hagedorn led liberal-backed Lisa Neubauer by 5,962 votes — less than half a percentage point — in a race that could still go to a recount. But it came after a string of losses by Republicans in special and statewide elections since Donald Trump carried the state.

While Republicans were excited, they were also cautious about what Hagedorn’s showing means for President Donald Trump’s re-election.

“Nobody should assume because Republicans won this race that they will continue to win everything else,” Republican strategist and former state GOP leader Brandon Scholz said. “This is one election where all the pieces came together at the end. 2020 is an entirely different, politically charged animal with the presidential race.”

Republican U.S. Sen. Ron Johnson, who has been leading GOP efforts to rebound following the 2018 election, credited Hagedorn’s showing with a ground-up engagement with conservatives who were angry with attacks in the race and national Democratic priorities.

“This is the recipe for success,” he said. “That’s what I’ve been preaching since the day after the November 2018 election. We have to energize, rely on the grassroots.”

Hagedorn benefited from a late infusion of $1.2 million from the Republican State Leadership Committee. Conservative talk radio, including former Republican Gov. Scott Walker for three hours the day before the election, also worked to drive up turnout.

Republicans compared attacks on Hagedorn to those on U.S. Supreme Court Justice Brett Kavanaugh. National political fights over the release of Robert Mueller’s investigation into Trump and ongoing court battles over a lame-duck legislative session in Wisconsin also fueled interest in the race, GOP strategists said.

Hagedorn said attacks against him over long-ago blog writings, including calling Planned Parenthood a “wicked organization” and denouncing court rulings that favored gay rights, motivated his supporters.

Democrats took the result as a sign that despite a string of wins, including ousting Walker in November, nothing can be taken for granted.

“Not that Democrats needed it, but it’s another wakeup call that every single election here is going to be highly competitive,” said Democratic strategist Joe Zepecki. “This is not a red state. This is not a blue state. This is the deepest shade of purple there is on the spectrum.”

Neubauer didn’t immediately say whether she would request a recount, which would face a tough challenge in overturning such a large margin and which would come at her expense. She immediately appealed to supporters for money in case she pursues the recount. Counties have until April 12 to report final vote totals, and Neubauer has three days after that to request a recount.

The Wisconsin Supreme Court has been the deciding force in several partisan battles over policy in recent years, and is itself clearly partisan — conservatives hold a 4-3 edge. Democrats had hoped Neubauer would capture a seat currently held by a liberal justice, maintaining that spread but positioning them to win the majority in another election next year.

Unless Hagedorn’s apparent victory is undone by recount, conservatives instead will enjoy a 5-2 majority and won’t be at risk of losing it until at least 2023. The high court already looks likely to decide early disputes between new Democratic Gov. Tony Evers and majority Republicans in the Legislature.

Turnout was nearly 27%, well above the 22% of last year’s state Supreme Court race. Hagedorn overcame Neubauer’s huge margins in the liberal strongholds of Madison and Milwaukee by running up the vote in Green Bay and more rural parts of northeastern and north central Wisconsin. Those are both parts of the state that helped fuel Trump’s win in 2016.

Wisconsin recounted its presidential vote in 2016 at Green Party candidate Jill Stein’s expense. In that recount of nearly 3 million ballots, only 131 votes were changed — in favor of Trump. Neubauer, in a recount of just 1.2 million ballots, would have to pick up 45 times as many votes.

The 2016 presidential recount cost local election clerks $2 million — more than the $1.7 million Neubauer raised during the entire campaign through March 18. However, those costs included overtime for clerks who had to count nearly 2.9 million votes under a tight deadline due to the Electoral College.

Given the recent tight elections, Republicans are taking nothing for granted going into 2020, Johnson said.

“We have to run almost perfect elections going forward,” he said “If (Democrats) are energized, we’re going to have issues. Nobody will be overconfident. We know what’s at stake.”