Two years ago, the odd quirks of the Electoral College allowed Donald Trump to become president with a scant 46 percent of the vote. Today, the rest of America struck back.

Republicans picked off Senate seats deep in red America, but in the more responsive House of Representatives, Democrats won seat after seat in urban and suburban America, swept to a majority, and brought an end to the Republican monopoly on power. The lesson is clear: Resistance works.

Since the day after Trump’s inauguration, ordinary people refused to sell out immigrants, refugees, trans people, or other scapegoats of the moment.

The protests that followed Trump’s inauguration were the largest mass demonstrations in American history. Crowds rushed to America’s airports to halt the first, and cruelest, version of Trump’s notorious travel ban. Thousands who called and protested played a crucial role in blocking the repeal of the Affordable Care Act, saving health coverage for millions of mostly low-income families.

The resistance fought hard to combat Trump’s policy initiatives in Congress. By no means did they win at every turn. Trump scored a meaningful policy legacy, but all of it is unpopular. His image on health care is in tatters, the polling on his tax bill is miserable, and Brett Kavanaugh is the least popular newly confirmed Supreme Court justice on record.

Women, as Lara Putnam and Theda Skocpol detailed, took the lead in rebuilding the Democratic Party and para-party organizations all around the country. Even as the media endlessly rehashed “Trump voters still like Trump” content, in suburbs and small towns all across the country, newly energized grassroots groups marched and phone-banked and organized, and tonight, they won.

Projection: today is the first day in history Americans have elected more than 100 women to the U.S. House of representatives. — Dave Wasserman (@Redistrict) November 7, 2018

The congressional Republican Party stood by Trump through it all. They abandoned their 2016-vintage promises to be independent of Trump and hold him accountable, and Trump betrayed his 2016-vintage promises to be independent and check the GOP’s plutocratic instincts. They decided they would rather hang together than risk hanging separately, and for their sins, they paid at the polls.

Resistance was a choice

Initially, some in the media and some Democrats interpreted Trump’s razor-thin Electoral College victory, in which he earned fewer votes than his opponent, as a sign that he was a repository of deep and important truths about the state of the country. Some Democrats had the initial instinct in that fateful winter to try to collaborate with Trump, perhaps on an infrastructure bill — a misguided instinct that, unfortunately, will likely rear its head again.

What happened instead was the most extraordinary sustained popular mobilization of my lifetime. And from the beginning, the electoral warning signs were there for Republicans to heed.

In special elections across the country, Democrats overperformed. Democrat Jon Ossoff lost the most expensive congressional election of all time in the Atlanta suburb — but he drastically outperformed any previous Democratic candidate in that district, and did essentially all of it with money raised from small donors. Rob Quist then repeated essentially the same feat in Montana a couple of weeks later.

Republicans saw these costly victories in red terrain as signs of strength, but they were in fact early warnings of weakness — weakness that broke through when a national outpouring of donors and volunteers helped power Doug Jones to an unlikely Senate win in Alabama that deprived Republicans of the numbers they needed to advance a 2019 legislative agenda.

These early signs of unpopularity would have been a good time for either Trump or congressional Republicans to turn back from the brink — with either the White House moving away from the deeply unpopular plutocratic policy agenda it inherited from House Republicans or Congress moving away from its complicity in Trump’s corruption and racial demagoguery — but they decided to press ahead undaunted with their partnership, and progressives continued to resist.

Almost nine years ago, Nancy Pelosi famously said that Democrats had to pass the Affordable Care Act so people could see what was in it. The conservative noise machine paired with superficial reporting glossed this as a gaffe — the then-speaker didn’t even know what her bill said — but her point, which was prescient, was that if the law actually took effect and people began to focus on its provisions rather than the hazy term “Obamacare,” they would like it.

The 2018 midterms were an enormous vindication of that insight. It turned out that one of the things in it was a massive expansion of Medicaid that people liked quite a lot and that Senate Republicans were nervous about repealing. Another thing in it was the protections for patients with preexisting conditions that proved to be the centerpiece of many winning Democratic Party campaigns. As much as Trump tried to make the election be about a few thousand Central Americans hundreds of miles away, to many voters, it was about a few hundred congressional Republicans in Congress trying to deregulate the insurance industry.

Republicans are paying the price

It should be acknowledged, of course, that there was a price to resistance.

Incumbent Senate Democrats Joe Donnelly, Heidi Heitkamp, Bill Nelson, and Claire McCaskill would have had better odds of hanging on to their seats had the party given a bipartisan imprimatur to more of Trump’s initiatives. And doubtless, some Republican optimists will offer themselves the spin that gains in the Senate offset losses in the House.

The truth, however, is that the Senate map was almost comically tilted toward the Republican Party.

Even in the House, gerrymandering created a situation in which Democrats needed to win the popular vote by 5 or more percentage points to secure a majority. In the end, it looks like they won by at least 8 (we won’t know the real number until all the votes are counted in California) and will secure a solid majority.

That’s an impressive victory in the face of gerrymandering and incumbency advantages. And, fortunately, victory itself can help assure a fairer playing field next time. With governors’ mansions in Michigan, Wisconsin, and Kansas now in Democratic hands and newly empowered Democratic trifectas in New Mexico and New York (adding to the ones already established in Washington and New Jersey as a result of the 2017 midterms), the stage is set for progressive legislation on guns, the minimum wage, clean energy, and other topics.

And, of course, House Democrats, led by Pelosi, are now poised to take the resistance back to Capitol Hill and begin exerting a meaningful check on Trump. But as fundamentally toxic and unpopular as Trump and Trumpism have proven to be, they’ll have to be smart about it.

Two traps for congressional resistance

The first pitfall Democrats will need to avoid is the return of the infrastructure temptation.

Two years ago, the idea of cooperating with Trump on his notional desire for a massive infrastructure bill was the leading alternative concept to resistance. Massive grassroots outrage plus Trump’s evident lack of engagement with serious talks put an end to that, but this past August, Democrats started talking about infrastructure again. In September, former top Trump administration economic policy adviser Gary Cohn talked up bipartisan cooperation on infrastructure for after the midterms. And by October, lobbyists were salivating at the possibility.

There’s more to life than partisan politics, and obviously if Trump is sincerely prepared to deliver Republican votes for a transformative overhaul of American infrastructure that massively speeds the transition to electrification of transportation and the greening of the energy mix, then Democrats can’t just refuse to cooperate.

But if, as seems more likely, we are really just talking about a routine reauthorization of the Surface Transportation Act that’s set to expire in 2020 with some more money thrown around to all the relevant stakeholders, then Democrats can’t afford to be the sucker party. It would make a lot more sense to stick to kick the can with a quiet extension of the existing law, rather than allow Trump to take credit for a major bipartisan deal that doesn’t accomplish much that’s meaningful.

After all, there will be plenty for Democrats to do on the investigative front, even if very little legislating happens.

Here, the party’s problem is an embarrassment of riches. With Trump awash in scandal, it’s possible that every subcommittee chair will be running her own investigation and the whole thing will turn into background noise.

A smart strategy will require strong leadership to insist on focus and message discipline. Investigations that can plausibly claim a scalp (the way EPA Administrator Scott Pruitt went down last year after his scandals became too numerous and too funny) are always worth pursuing when they come up. But in terms of Trump himself, who pretty obviously isn’t going anywhere unless he’s beaten at the polls in 2020, Democrats will need to be ruthless editors and pick one or two lines of inquiry that advance their most electorally potent angles.

Most of all, they need to stay nervous. Every party that sweeps to midterm victory thinks history’s winds are at its back. But Republican wins in 1994 and 2010 were followed by successful Democratic reelection bids in 1996 and 2012. Trump’s existence in office is a real and ongoing threat to the rule of law and the stability of American institutions. But the very fact of a Democratic House will prevent him from a repeat of 2017’s hideously unpopular bills. For now, though, he not only lacks majority support — he’s never had it.

The unpopular “populist”

Trump entered office not only having lost the popular vote but — uniquely among presidents — with an underwater favorability rating. George W. Bush got fewer votes than Al Gore, and Bill Clinton prevailed in a three-way field with just 42 percent of the vote, but both were popular on their inauguration days and enjoyed a honeymoon period with the mass public.

The Trump administration, by contrast, has consistently tried to run plays out of the authoritarian populist playbook — casting criticism and opposition as unpatriotic betrayals of the will of the people — without ever actually achieving popularity. Brazil’s new President-elect Jair Bolsonaro, repugnant as he may be, won an actual election in which he got most Brazilian voters to back him. Trump’s entire viability, by contrast, has been due to the geographic happenstance of the Electoral College, backed up by the Senate’s structural underrepresentation of people of color and boosted by a House GOP majority that gerrymandered itself into softness and complacency.

Believing that only a profoundly enormous landslide could cost them control of Congress, Republicans treated Trump as if one of the least popular presidents on record was a genius. And much of the press went along, treating recklessness as a form of political savvy.

It was not. The state of semipermanent emergency that the country has been in since Trump’s election (just one week ago, he casually floated the idea of issuing an executive order to somehow unilaterally alter the constitutional status of US-born children of unauthorized immigrants) continues, and the risks of a high-stakes institutional showdown are in some ways now elevated. But the myth of a Teflon Trump is dead, along with the bizarre notion that 45 percent or so of the public constitutes a “silent majority” that craves incompetence and white nationalism.

The resistance won because resistance works.