Were they alive today, most of America’s founders would not be surprised by the electoral successes of Donald Trump and Bernie Sanders. Trump and Sanders, whose experience and policy proposals make them implausible and potentially disastrous presidents, both are the product of political factions, which James Madison cautioned against in Federalist #10.

“By a faction,” wrote Madison, “I understand a number of citizens, whether amounting to a majority or minority of the whole, who are united and actuated by some common impulse of passion, or of interest, adverse to the rights of other citizens or to the permanent and aggregate interests of the community.”

While interest might explain why some voters favored Sanders—with his laundry list of promises, from free health care to free college education—the strong support for both Trump and Sanders arose mostly from their appeal to “common impulse[s] of passion.” Sanders’ supporters resent what he portrays as a rigged economic system benefitting only the wealthy, while Trump’s fear that immigrants are stealing their jobs and that foreign leaders are outsmarting incompetent American officials—and both groups are passionate in their beliefs.

A “pure democracy,” explained Madison, “can admit of no cure for the mischiefs of faction.” But a republic, he continued, “by which I mean a government in which the scheme of representation takes place, . . . promises the cure for which we are seeking.” The Framers believed that cooler heads would prevail if the people’s impulses were funneled through elected representatives in government. And, in fact, representation was only one part of the Founders’ remedy for the mischiefs of faction. They also separated the powers of government among three branches, established a Senate in which states, not people, have equal voice, established the electoral college rather than direct popular vote for the selection of the president, divided powers between the national and state governments, and allowed that individual rights would prevail over national (and later state) power.

Writing in 1959, Pulitzer Prize–winning journalist Felix Morley asked, “How is it . . . that a form of government so politically undemocratic as that of the United States, should nevertheless be habitually referred to as a ‘democracy’ . . . ?” Over the succeeding half-century, Americans and our leaders have become even more insistent that the core value of our constitutional system of government is democracy. Both Trump and Sanders have claimed repeatedly that the system is rigged, by which they mean that the will of the voters is somehow being frustrated. Although Trump’s lament seems puzzling in light of his success at the polls, the ongoing ‘dump trump’ maneuverings give him ample reason to believe that the so-called Republican establishment would counter the will of the people if only it could find a way. Sanders supporters are understandably frustrated by Hillary Clinton’s success despite Sanders’ repeated primary victories. Most of her lead in delegates is built on commitments from super delegates who are free to ignore the will of primary voters. This may seem unjust to Sanders supporters, but it’s the sort of constraint on pure democracy that Madison defended in Federalist #10.

Were those who wrote and ratified the Constitution around today, few would object that Clinton’s super delegates or a scheming Republican establishment are breaking faith with the core principles of American constitutionalism. As the historian Jackson Turner Main observed in writing about the anti-Federalist opposition to the proposed Constitution, among those assembled in Philadelphia, there were “none who spoke out clearly for democracy.” Over the brief life of the Articles of Confederation, under which state legislatures functioned with few constraints, the Framers learned firsthand about the hazard of factions, or what the founding generation often referred to as the “licentiousness of the masses.” As a result, they designed a government in which the people exercised no direct power and only representatives to the lower chamber of Congress were selected by popular vote. And although the Seventeenth Amendment provides for popular election of members of the Senate, individual Senators continue to represent vastly disproportionate numbers of voters.

Recurrent proposals to abandon the electoral college in favor of the popular vote reflect the persistent notion that ours is, first and foremost, a democracy. But the successes of Trump and Sanders confirm that the case for pure democracy is no stronger today than it was in 1787.

Factions and the tyranny of the majority remain threats wherever democracy is unconstrained. Witness the sad fates of Germany under Adolph Hitler, Zimbabwe under Robert Mugabe, the Philippines under Ferdinand Marcos, Venezuela under Hugo Chávez, Bolivia under Evo Morales, and Russia under Vladimir Putin, all democratically elected leaders. The lesson, in the oft-quoted words of Winston Churchill, is that “democracy is the worst form of government except all those other forms that have been tried from time to time.” As the foregoing examples underscore, democracy can fail with horrific consequences.

The case for democracy is not that majorities should define the public good—that over half of voters should have the authority to dictate to their fellow citizens. Rather, the case for democracy is that, better than any other form of government, it allows individuals a say—an expression of their private liberty—in decisions of the community. As historian Gordon Wood writes in The Creation of the American Republic: “Public liberty was thus the combining of each man's individual liberty into a collective governmental authority, the institutionalization of the people’s personal liberty, making public or political liberty equivalent to democracy or government by the people themselves.” Our constitutional founders preferred limited democracy as a form of government founded in individual liberty yet insulated against factional abuses of liberty. The democratic republic they created is by no means a guarantor of private liberty, but it’s the best they could do.

We need not rely on the beliefs and experiences of the founding generation, however, to understand that limited democracy is the better course if we care about freedom. We have the nomination of a demagogue by the Republican Party and the powerful showing of a self-described socialist in the Democratic primaries to remind us of the hazards of unfiltered democracy.

Sadly, our embrace of democracy as the core value of our Constitution has led us to accept constraints on liberty, often imposed by bare majorities, as the natural and proper outcome of government. We do not question that winning 55 percent of the vote is called a landslide, notwithstanding that 45 percent of the voters favored a different candidate. In the primary season that just ended, a win by a few thousand votes warranted the same election night celebration as did a win by hundreds of thousands of votes. Election winners cannot resist spiking the ball in the endzone because they accept that democracy is a winner-take-all contest.

Where democracy is limited by constitutional design, however, as American democracy is—where limited democracy is accepted as that form of government least likely to violate the liberties of its citizens—the expressed preferences of those who voted for the losing candidate are not discounted to zero. Although the democracy-limiting constraints of the Constitution have been eroded over the course of American history by executive excesses, congressional power grabs, and judicial deference to both at the expense of individual rights, the Constitution remains a bulwark against the powerful forces of faction.

But primary elections are a different matter. They are, in important respects, private affairs governed not by the Constitution but by rules promulgated by the political parties. For decades, both parties have been pressured to abandon the decision-making of smoke-filled rooms in favor of purely democratic contests in which the so-called party establishment has no special influence. Delegates to the party conventions at which the presidential candidates are nominated are chosen directly by the people. Ironically, it is the Democratic party that would have been saved from the Sanders faction by its modern version of the smoke-filled room. Republicans, to the frustration of those who saw 2016 as a golden opportunity to retake the White House, have no super delegates or other constraints on the will of the people to save them from Donald Trump.

Of course, the millions who supported Trump and Sanders in the primaries had no interest in being rescued by the party establishments. Each faction is as passionate as the other in its support for its candidate, precisely the risk Madison warned against. To be sure, the political parties and our elected leaders should not ignore or dismiss the passion. There is clearly a high level of dissatisfaction on both the left and the right. But if a belief in pure democracy leads us to allow factions of either the left or the right to rule, we will have sacrificed the very liberties democracy is meant to preserve.

overlay image