This year, for the fourth time in history—and second time in recent history– a presidential candidate won the popular vote but lost the Electoral College and, therefore, lost the election. Hillary Clinton received 200,000 more votes than Donald Trump nationwide, yet lost handily in the Electoral College. Blame it on an anachronistic and undemocratic system that was established for the sake of preserving the institution of slavery and upholding the power of slaveholding states.

A prevailing myth surrounding the Electoral College was that the system was designed to protect small states, as The Washington Post reported. However, at the time of the 1787 Constitutional Convention in Philadelphia, the real division was between those states which practiced slavery and those which did not. Electing the president through a straight tally of eligible voters would not work to the advantage of slaveholding states of the South, as they had a small number of eligible voters—wealthy, white landowners—but large numbers of people who were unable to vote, including over half a million enslaved Africans at the time.

At the convention, James Wilson of Pennsylvania called for presidential elections based on the national vote, to which Virginian James Madison responded: “The right of suffrage was much more diffusive [i.e., extensive] in the Northern than the Southern States; and the latter could have no influence in the election on the score of Negroes.” Madison meant that the North would overrun the South in the electoral process. As a result, the convention allowed Southern states to count three-fifths of their enslaved population to determine the representation of each state in Congress, creating a perverse incentive allowing these states to benefit from the institution. Accumulate more enslaved people and increase your influence in the federal electoral system. Free your Black people and watch your political power wane.

The largest beneficiary of this process was Virginia, the California of the founding era of the nation, according to Time, with 12 out of 91 electoral votes—over a quarter of the 46 votes required for victory. In the 1800 census, Pennsylvania, which did not enslave people at the time, had 10 percent more free citizens than Virginia, but 20 percent fewer electoral votes.

“The Electoral College was designed at Philadelphia and was revised in the wake of the Jefferson-Adams-Burr election of 1800-1801 to advantage the slaveholding South,” wrote Yale constitutional law professor Akhil Reed Amar wrote in his new book, The Constitution Today.

Thomas Jefferson, himself an owner of the enslaved, could not have won the presidency without the Electoral College and the bonus it provided to Virginia and the other states that held Black people in bondage. When the Twelfth Amendment was debated in Congress in 1803, Congressman Samuel Thatcher of Massachusetts noted that “The representation of slaves adds thirteen members to this House in the present Congress, and eighteen Electors of President and Vice President at the next election.” Thatcher’s complaint went unaddressed, and the amendment did not allow for a popular vote in presidential elections, retaining the Electoral College and only tweaking it at the edges.

As the Los Angeles Times reported, before 2016 there were three other elections in which the winner of the Electoral College vote did not receive the majority of the popular vote. In 2000, Al Gore won 539,000 more votes than George W. Bush, but won the Election due to Florida and the U.S. Supreme Court. In 1888, Grover Cleveland captured the popular vote, but Benjamin Harrison went to the White House. And in 1876, although Samuel Tilden received more popular votes than Rutherford B. Hayes, Hayes prevailed under the Compromise of 1877.

Meanwhile, as Scott Lemieux noted in The New Republic, the Electoral College has disenfranchised people of color in the 2016 election, underrepresenting Clinton’s diverse urban coalition, and overrepresenting Trump’s white and rural voter base.” Trump’s white nationalist demagoguery was unable to secure a plurality, let alone a majority, in a racially diverse country—but he didn’t need one,” he wrote.

Slavery was abolished, but the Electoral College—itself based on slavery—remains. Perhaps the most hopeful effort to reform America’s election system is the National Popular Vote Interstate Compact, in which each state agrees to award all of its electoral votes to the candidate who wins the popular vote. And in a last ditch effort to prevent a Trump presidency, a petition on Change.org urging the Electoral College to award the presidency to Hillary Clinton has received over 2.6 million supporters. “24 states bind electors. If electors vote against their party, they usually pay a fine. And people get mad. But they can vote however they want and there is no legal means to stop them in most states,” reads the petition.