The stunning upset election of Donald Trump has left many Americans wondering what has become of their country, their party, their government, even their sense of the world. Purple prose has been unleashed on the problem; comparisons to fascism and totalitarianism abound. Commentators claim that Trump’s election reflects a racist, sexist, xenophobic America. But we should resist the temptation to draw broad-brush generalizations about American character from last Tuesday’s outcome. The result was far more equivocal than that; a majority of the voters rejected Trump, after all. There is no question that President Trump will be a disaster—if we let him. But the more important point is that—as the fate of American democracy in the years after 9/11 has taught us—we can and must stop him.

The risks are almost certainly greater than those posed by any prior American president. Trump, who has no government experience, a notoriously unreliable temperament, and a record of demagoguery and lies, will come to office with Republican majorities in both houses of Congress, and, once he fills the late Antonin Scalia’s seat, on the Supreme Court as well. His shortlist of Cabinet appointees offers little hope that voices of moderation will be heard. Who, then, is going to stop him? Will he be able to put in place all the worst ideas he tossed out so cavalierly on the campaign trail? Building a wall; banning and deporting Muslims; ending Obamacare; reneging on climate change treaty responsibilities; expanding libel law; criminalizing abortion; jailing his political opponents; supporting aggressive stop-and-frisk policing; reviving mass surveillance and torture?

Whether Trump will actually try to implement these promises, and more importantly, whether he will succeed if he does try, lies as much in our hands as in his. If Americans let him, Trump may well do all that he promised—and more. Imagine, for example, what a Trump administration might do if there is another serious terrorist attack on US soil. What little he has said about national security suggests that he will make us nostalgic for George W. Bush and Dick Cheney.

We let a minority of voters give Trump the presidency by not turning out to vote for Clinton. (Trump didn’t even get as many votes as McCain and Romney, but Clinton received nearly five million fewer votes that Obama in 2012). But if we now and for the next four years insist that he honor our most fundamental constitutional values, including equality, human dignity, fair process, privacy, and the rule of law, and if we organize and advocate in defense of those principles, he can and will be contained. It won’t happen overnight. There will be many protracted struggles. The important thing to bear in mind is that if we fight, we can prevail.

If you think this is overly naive, consider the fate of George Bush’s “war on terror.” In the immediate aftermath of the terrorist attacks of September 11, 2001, Bush acted as if he were entirely unconstrained. He had reason to think that he could get away with it. His popularity soared to its highest level. The Supreme Court had just voted to put him in office. He had a solid Republican majority in the House of Representatives, and the Democrats had only a razor-thin majority in the Senate (thanks to Senator James Jeffords’s decision in June 2001 to switch from Republican to Independent, and to caucus with the Democrats).

More to the point, history was on Bush’s side; neither Congress, the Supreme Court, nor the American people had ever put up much if any resistance to a president in dealing with the “enemy” in a time of war. Presidents had jailed hundreds for merely speaking out against the war in World War I, and had interned 110,000 people on the basis of their Japanese ancestry during World War II. We and our institutions did nothing to stop those efforts. Assuming he would have a similarly free hand, Bush authorized disappearances of terror suspects into secret CIA prisons, torture as an interrogation tactic, indefinite detention at Guantanamo without hearing or judicial review, “extraordinary rendition” of suspects to third countries so that they could torture them for us, and warrantless electronic surveillance of Americans. He insisted that he could ignore federal criminal statutes, that the Geneva Conventions did not apply to al-Qaeda detainees, and that Guantanamo was beyond the law.

For much of his first term, Bush did indeed get away with such tactics. But much to his dismay, Americans did not sit back and accept that the executive was above the law. As I describe in my recent book, Engines of Liberty: The Power of Citizen Activists to Make Constitutional Law, they protested, filed lawsuits, wrote human rights reports, lobbied foreign audiences and governments to bring pressure to bear on the United States, leaked classified documents, and broadly condemned the administration’s actions as violations of fundamental constitutional and human rights. Human Rights First organized retired generals and admirals; the Center for Constitutional Rights and Reprieve, aided by an army of pro-bono lawyers, brought the plight of Guantanamo detainees to the world’s attention; the Bill of Rights Defense Committee sparked a grassroots protest through local referenda on the Patriot Act; and the ACLU used the Freedom of Information Act to dislodge thousands of documents detailing the CIA’s torture program, which it and PEN American Center then disseminated in accessible form. The academy, the press, and the international community all joined in the condemnation.

As a result, the course of history changed. By the time Bush left office in 2009, he had released more than five hundred of the detainees from Guantanamo, emptied out the CIA’s secret prisons, halted the CIA interrogation program and extraordinary renditions, and placed the NSA’s surveillance program under judicial supervision. His claims of uncheckable executive power had been rejected, and the Geneva Conventions applied to all detainees.

Bush did not introduce these reforms because he came to realize his wrongs. His memoir, like that of his vice-president, Dick Cheney, is entirely unrepentant. But Bush was nonetheless checked—by American civil society, international criticism, and, for the first time in history, the Court and Congress. The Supreme Court established that any detainee held at Guantanamo has a right to judicial review (Boumediene v. Bush), that the Geneva Conventions apply to all Al Qaeda detainees (Hamdan v. Rumsfeld), and that the president cannot hold US citizens as enemy combatants without affording them a meaningful opportunity to defend themselves (Hamdi v. Rumsfeld). And in 2005 Congress, under Republican Senator John McCain’s leadership, and over the administration’s strenuous objections, adopted the Detainee Treatment Act, a bipartisan prohibition on the use of cruel, inhuman, and degrading tactics against anyone in US custody—therefore barring waterboarding and other patently cruel interrogation tactics.

These rules and precedents will rein in Trump, just as they reined in Bush. Moreover, the combined effect of international condemnation of the CIA torture program, Obama’s repudiation of it, and the damning report about it by the Senate Select Committee on Intelligence will make any effort to revive those tactics extraordinarily difficult. (By contrast, Obama’s troubling use of drones to engage in secret targeted killing far from any battlefield leaves Trump an extremely dangerous weapon. While Obama introduced some reforms to the drone program in the latter part of his administration, they are not binding on a subsequent president, and because the existing guidelines continue to permit secret killing, they defeat any meaningful accountability.)

So if Bush could be stopped, notwithstanding widespread popular support, a large-scale attack on US soil leading to a war footing, and a history of judicial and congressional acquiescence in similar prior periods, Trump is also stoppable. He doesn’t have anything like the popular support Bush had after 9/11. And the recent history of the repudiation of Bush’s abuses will make it harder to repeat them.

Much of what Trump has proposed is patently illegal. Torture violates the Constitution, international law, and the Geneva Conventions. Deporting or singling out Muslims for discriminatory treatment violates the freedom of religion. Congress cannot expand libel, whose contours are determined by the First Amendment. The right to terminate a pregnancy remains protected by the Constitution, and the Supreme Court strongly reaffirmed that right just last year. A bipartisan Congress ended the NSA’s bulk collection of Americans’ phone metadata in 2015, after a court of appeals ruled the program illegal. And the terms of our climate change treaty preclude backing out for four years.

There is no way to guarantee that Trump will not try to implement at least some of his campaign promises. He has already vowed to deport two to three million people, and to repeal and replace major parts of Obamacare. The time to stop him in his tracks was at the voting booth, and we failed to do that. But as the fate of the Bush administration’s counter-terror measures illustrates, even when the executive seems most invincible, he can be checked. Doing so will take an engaged citizenry, a persistent civil society, a vigilant media, brave insiders, and judges and other government officials who take seriously their responsibility to uphold the Constitution. (I look forward to taking part in this effort myself, as I become the National Legal Director of the ACLU in January, a few days before Trump takes office.)

We live in a constitutional democracy, one that is expressly designed to check the impulses of dangerous men. It will do so if and only if we insist on it.