Roy Moore was a uniquely flawed and vulnerable candidate. But what should worry Republicans most about his loss to Democrat Doug Jones in Tuesday’s U.S. Senate race in Alabama was how closely the result tracked with the GOP’s big defeats last month in New Jersey and Virginia—not to mention how it followed the pattern of public reaction to Donald Trump’s perpetually tumultuous presidency.

Jones beat Moore with a strong turnout and a crushing lead among African Americans, a decisive advantage among younger voters, and major gains among college-educated and suburban whites, especially women. That allowed Jones to overcome big margins for Moore among the key elements of Trump’s coalition: older, blue-collar, evangelical, and nonurban white voters.

This was the same equation that powered the Democratic victories in the Virginia and New Jersey governors’ races. The consistency of these results suggests that Democrats are coalescing a powerful coalition of the very voters that polls have shown are the most disenchanted, even disgusted, by Trump’s performance and behavior as president.

That points to a clear near-term threat in 2018 for Republicans. It also crystallizes the risky long-term trade Trump is imposing on his party: He is improving the GOP’s standing among groups that are almost all shrinking in the electorate, at the price of alienating groups that are growing.

It’s true that Jones won only very narrowly over Moore, a candidate so polarizing that he struggled in Alabama even before he was battered by extensive allegations of sexual misconduct with teenage girls, including some who were underage. But Jones won in a state where Republicans enjoy as dominant an overall advantage as they do virtually anywhere. Last year, Trump carried Alabama by nearly 590,000 votes. Since 2008, the only statewide race Alabama Democrats have won is a single public-service commissioner position that year; no Democrat carried more than 41.4 percent of the vote in any statewide race in 2014 or 2016. And no Democrat has won an Alabama Senate seat since 1992, when Richard Shelby did it before switching his political allegiance to the Republican Party.

Jones contradicted that history by consolidating the groups most dubious of Trump. The granite foundation of his victory was his huge performance among African Americans, who gave him 96 percent of their votes and accounted for 29 percent of all voters, according to exit polls reported by CNN. That was a slightly better showing, on each front, than even Barack Obama managed in 2012, according to the exit poll conducted that year, the most recent one in the state. In counties with large African American populations (such as Jefferson, which includes Birmingham; Dallas, which includes Selma; and Montgomery), Jones exceeded not only Hillary Clinton’s share of the vote in 2016, but also, in some cases, bested her lead in raw votes—an incredible gain in a nonpresidential election. Although rarely discussed, the state’s growing Latino and mixed-race populations also put an important thumb on the scale for the Democrat; they represented about 5 percent of voters.

Jones next posted a solid advantage among younger voters. He carried about three-fifths of those ages 18 to 29, and also about three-fifths of those ages 30 to 44. Jones’s advantage with minority voters partly explains that edge, but he also ran nearly 15 percentage points better with whites under 30 than with their older counterparts.

The final piece explaining Jones’s win was the substantial inroads he made with college-educated whites, especially women. Jones won 40 percent of those voters. While by national standards that’s not a great number, it’s exactly twice as large a share as Obama won in Alabama in 2012. Jones lost college-educated white women by just 7 percentage points; in 2012, Obama lost them by 55 points. Obama won fewer than one in five college-educated white men; Jones pushed that slightly past one in three. In counties with large concentrations of well-educated voters—such as Madison, which includes Huntsville; Shelby, near Birmingham; Lee, the home of Auburn University; and Tuscaloosa, the home of the University of Alabama—Jones consistently ran about 20 percentage points ahead of Clinton.

Moore’s own words and actions provided plenty of provocation for minorities, Millennials, and college-educated whites. But these key groups moved the same way in November’s major elections. In both the New Jersey and the Virginia governors’ races, Democrats won about 70 percent of Millennials and half of college-educated whites, and they enjoyed solid turnout and preponderant margins from nonwhite voters. In all three states, the core Trump groups of older, blue-collar, evangelical, and rural whites remained loyal to Republicans (although Moore’s margins with those voters eroded slightly relative to Mitt Romney’s in 2012). But they couldn’t match the impassioned turnout among the groups hostile to Trump.

“Anti-Trump fever is now so strong among Democrats, young voters, and independents that the GOP is likely to face a surge in turnout on the Democratic side that will make the 2018 midterms lurch toward the demographics of a presidential year,” says longtime GOP strategist Mike Murphy, who advised Attorney General Jeff Sessions when he first won his Alabama Senate seat, in 1996. “That is a looming disaster that could well cost the GOP control of the House. We are in a Trump-driven worst-case situation now.”

One of the clearest messages from 2017’s big contests is that other Republicans are now closely bound to their volatile and vitriolic president. Exit polls showed that among voters who disapproved of Trump, the Democrats won 82 percent in New Jersey, 87 percent in Virginia, and 93 percent in Alabama. Few congressional Republicans have tried to establish much independence from Trump, yet in most places he is even less popular than he was on Tuesday in Alabama, where exit polls showed voters splitting evenly over his job performance. After Alabama, Republicans up and down the ballot face urgent choices about whether they will continue to lash themselves to the mast of Trump’s storm-tossed presidency.