Alan Abramowitz is the Alben Barkley Professor of Political Science at Emory University.

Republican Roy Moore was the most important reason that Democrat Doug Jones won Alabama's U.S. Senate election on Tuesday. Moore was simply an atrocious candidate. This can be seen clearly in exit poll results showing that only 41 percent of voters in this Republican stronghold had a favorable opinion of the scandal-plagued GOP nominee. In contrast, 51 percent had a favorable opinion of Jones.

A different Republican candidate, probably even the one Moore defeated in the Republican primary, Sen. Luther Strange, would almost certainly have won. But even with a less controversial nominee, the GOP margin probably would have been the smallest in any Alabama Senate contest in recent years and far smaller than Donald Trump's 28-point 2016 margin in the state over Hillary Clinton.

When Alabama voters were asked which party they would prefer to control the Senate, 50 percent chose Republicans while 45 percent chose Democrats. That is a stunning result — perhaps even more stunning than Jones's victory. Moreover, only 43 percent had a favorable opinion of the Republican Party while 47 percent had a favorable opinion of the Democratic Party.

President Trump worked hard to help Moore. But even in Alabama, one of the most conservative and Republican states in the nation, Trump's support has eroded considerably in the past year. Only 48 percent of voters in the exit poll approved of his performance, while an identical 48 percent disapproved. Those who strongly disapproved outnumbered those who strongly approved 40 to 33 percent.

Jones's improbable victory was much more than a rejection of Moore. It reflected a broader trend within the American electorate since the 2016 presidential election. Trump's presidency has divided Republicans and energized Democrats. As a result, Democrats have made substantial gains in special and off-year elections.

Last month, Democrats won the Virginia gubernatorial election by a larger-than-expected margin. More surprisingly, they made substantial gains in the Virginia House of Delegates, coming close to regaining control of that chamber. At the same time, Democrats were making inroads in special elections across the country, including flipping three GOP-held seats in the Georgia legislature.

Notably, the same coalition of upscale whites and minority voters that propelled Democrats to victory in Virginia was evident in the Alabama results. Based on the exit poll, African Americans made up 29 percent of voters in the Alabama Senate election, slightly higher than their 28 percent share of the Alabama electorate in 2012 — a presidential election with an African American candidate heading the Democratic ticket. And Jones won 96 percent of the African American vote — slightly higher than the 95 percent won by Barack Obama in 2012.

Moore won 68 percent of the white vote in Tuesday's special election, but that was far less than the 84 percent that Republican Mitt Romney won in the 2012 presidential election — the most recent presidential contest with exit-poll results for Alabama. And while Moore won 77 percent of the vote among whites without college degrees, he won only 57 percent among whites with college degrees and only 52 percent among white women with college degrees.

Jones's victory does not mean that Alabama is about to become a swing state. White voters in Alabama are far more conservative than white voters in rim-South states such as Virginia and North Carolina, where Democrats have been successful in recent statewide elections. Even with a strong turnout among African American voters, Jones will have a difficult time holding his seat in 2020. The Democratic presidential nominee will be an even bigger underdog against Trump or any other GOP candidate.

However, Jones's victory reinforces the conclusion, based on the results of numerous special and off-year elections and other leading indicators, that 2018 is shaping up to be a Democratic wave election.

One of those leading indicators is the generic ballot — a question on numerous polls asking voters if they would prefer a Democrat or a Republican for Congress. Based on an average of recent national polls, a generic Democrat now holds a 10-point lead over a generic Republican. That is the largest Democratic advantage on the generic ballot question since 2008 and, if it continues into next fall, it would predict substantial Democratic gains in the midterm elections. The Republican Party's problems are far deeper than Roy Moore.