For only the fourth time in U.S. history, the presidential campaign has ended with an electoral college winner who won fewer votes than his opponent.
Under the system established in the Constitution, in 1787, the winner is the candidate who wins the majority of electoral votes based on the state-by-state tallies, and that candidate is Donald Trump.
Hillary Clinton will finish second, even though she may end up beating him by more than 1 million votes in the national popular vote once the final tally is completed, assuming current trends continue.
For Democrats, it makes for a painful repeat of recent history.
In 2000, Vice President Al Gore won 539,000 more votes than Texas Gov. George W. Bush, but Bush won the presidency because he squeaked out a victory in Florida, following a U.S. Supreme Court decision that stopped a recount, giving him a majority of the electoral votes.
The system nearly worked in the opposite direction four years later. Had John F. Kerry won 60,000 more votes in Ohio, he could have won the White House, even though President Bush won 3 million more votes than his Democratic challenger.
Before that, such a situation hadn't occurred since 1888. That's the year Benjamin Harrison was elected president even though Grover Cleveland won the popular vote.
Before that, in 1876, Samuel Tilden beat Rutherford B. Hayes in the popular vote, but ultimately lost in a complicated political deal known as the Compromise of 1877.
The electoral system is a legacy of the Constitution, part of an agreement between states, including Southern states that had more slaves than free men who were eligible to vote.
It was also an era when ordinary people living far from the handful of cities could not be expected to know leading figures of the time who could serve as the chief executive.
"So they decided to delegate the decision to wise elites. The framers thought they would be a check on demagogues and the popular passions," said Jeffrey Rosen, president of the National Constitution Center in Philadelphia. "It seems antiquated, and it didn't work as they anticipated."
At first, the delegates to the 1787 convention considered having the elected members of Congress choose the president, similar to the way the British prime minister is selected by members of the parliament. But James Madison believed in separating power whenever possible, and he argued for electors who would be independent of Congress.
The Constitution does not use the phrase "electoral college." Rather, it says "Each state shall appoint … a number of electors" that is equal to its representation in Congress, including its two senators.
However, by the early 1800s, the state electors were voting as a block in favor of the presidential candidate who won the most votes in their state. So the electoral college did no debating or deliberating, but instead became a mechanism for registering the state's decision.
Critics of the electoral college have pointed out how slavery played a role in its creation. Southern delegates to the Philadelphia convention feared their states could be dominated by the new federal government because the Northern states had more people and more voters. So they fashioned a compromise that divided power based on counting the "whole number of free persons" in the states as well as "three-fifths of all other persons." Thanks to this infamous deal, the Southern states were bolstered and given more seats in the House of Representatives as well as more "electors" who selected the president.
Pennsylvania may have had more free people and voters than Virginia, but the largest Southern state had more electors. "It's no accident that for 32 of the first 36 years, the presidency was occupied by a white, slave-holding Virginian," said Yale Law Professor Akhil Amar, a longtime critic of the electoral college.
While the Civil War ended slavery and the "three-fifths" deal, the electoral system survived as the method for choosing the president, in part because the Constitution is very hard to change. Amendments need the approval of two-thirds of the House and Senate and three-fourths of the states.
Supporters of the electoral system say it encourages candidates to campaign across many states, rather than focusing on the huge states, such as California or Texas.
But in practice, presidential candidates tend to ignore states where one party already dominates, such as California, Texas and New York, and instead focus on the half-dozen states that are deemed to be "battlegrounds" where either party might prevail.
One possibility for changing the system is the National Popular Vote bill. The Constitution says states may decide on their own how to allocate their electoral votes, and a reform group is calling for states to agree by law to allocate all of their electoral votes to the winner of the national popular vote. So far, 11 states, including California, New York and Illinois, have said they would support this proposal. But the idea has won little traction in the Republican-leaning red states.
Still, many critics have insisted the electoral system violates the basic principle that it is voters who elect the president, so the winner should be the candidate who wins the most votes.
One such critic in November 2012 was Donald Trump, who tweeted: "The electoral college is a disaster for democracy."
Nov. 11, 1:10 p.m.: This article was updated with the latest estimates of Clinton's total in the popular vote.
Nov. 10, 6:20 p.m.: This article was updated with additional information about the other races in which the victor lost the popular vote.