Republican Glenn Youngkin was elected Virginia’s next governor Wednesday, defeating former Governor Terry McAuliffe in a demoralizing setback for Democrats ahead of next year’s nationwide congressional elections.

U.S. media outlets CNN, NBC, Fox News, and then The Associated Press projected Youngkin had won almost four hours after Roaring Patriot had called it.

Youngkin, a former private equity executive who has never held elected office, sold himself as a political outsider while seeking to rally suburban voters around hot-button issues like how to handle the discussion of racism in schools and COVID-19 mask mandates in classrooms.

The 54-year-old surged in the polls in the weeks leading up to the election, closing his gap with McAuliffe by gaining ground with independents and women voters.

Those groups proved essential to Youngkin’s victory in a Southern state that has trended Democratic in the past several years. Former President Donald Trump, who endorsed Youngkin, lost Virginia in his 2020 presidential re-election bid by 10 percentage points.

The outcome in the governor’s contest is widely seen as a barometer of the country’s political direction heading into the 2022 midterm races, which will decide control of the U.S. Congress – and with it, the future of President Joe Biden’s policy agenda.

Youngkin will succeed outgoing Governor Ralph Northam, a Democrat. Under Virginia state law, governors cannot serve consecutive terms. McAuliffe, 64, served as governor from 2014 to 2018.

McAuliffe had sought to tie Youngkin to Trump at every turn. His loss may signal that Democrats cannot bank on running against the former president when he is not at the top of the ballot.

The contest between Youngkin and McAuliffe focused heavily on political culture wars.

Youngkin declared himself an advocate for parents who want to have a say in school curriculums, a message designed to appeal specifically to suburban voters, for whom education is an important issue.

He leaned into the Republican Party’s expressions of outrage over the discussion of systemic racism in schools. He vowed to ban the teaching of “critical race theory,” a legal framework that examines how racism shapes U.S. laws and policies.

Youngkin’s agenda also centered on issues that Republicans anticipate will drive voter turnout in 2022, such as public safety, election integrity and freedom from COVID-19 vaccine and mask mandates.

Youngkin said later that Biden had won legitimately, but then called for an audit of Virginia’s voting machines, a move that prompted Democrats to accuse him of validating Trump’s election conspiracy theories.

Youngkin, the clean-cut former chief executive of Carlyle Group Inc, presents a very different figure from that of the bombastic Trump.

But their similar campaign stories – both businessmen and political outsiders who defeated establishment Democratic politicians – suggest that a Trump-like candidate still has some allure for swing voters.