Why is it that one candidate can win the popular vote but another wins the electoral vote and thus the presidency? Because that’s how the framers of the Constitution set it up.

This unique system of electing presidents is a big reason why Donald Trump won the presidency in 2016. Four candidates in history have won a majority of the popular vote only to be denied the presidency by the Electoral College.

The Electoral College was devised at the Constitutional Convention in 1787. It was a compromise between those who wanted direct popular elections for president and those who preferred to have Congress decide. At a time of little national identity and competition among the states, there were concerns that people would favor their regional candidates and that big states with denser populations would dominate the vote.

The Electoral College has 538 members, with the number allocated to each state based on how many representatives it has in the House plus its two senators. (The District of Columbia gets three, despite the fact that the home to Congress has no vote in Congress.)

To be elected president, the winner must get at least half plus one — or 270 electoral votes.

This hybrid system means that more weight is given to a single vote in a small state than the vote of someone in a large state, leading to outcomes at times that have been at odds with the popular vote.

In fact, part of a presidential candidate’s campaign strategy is drawing a map of states the candidate can and must win to gather 270 electoral votes.

In 2016, for instance, Democrat Hillary Clinton received nearly 2.9 million more votes than Trump in the presidential election, after racking up more lopsided wins in big states like New York and California. But she lost the presidency due to Trump’s winning margin in the Electoral College, which came after he pulled out narrow victories in lesser populated Midwestern states like Michigan and Wisconsin.

In the aftermath of Clinton’s loss in 2016, some Democrats urged a switch to the popular vote as the method of picking the president. That’s because they feel disadvantaged by the Electoral College. But a switch would require a constitutional amendment and is unlikely to succeed.