As he introduced Hillary Clinton’s concession speech today, Tim Kaine congratulated the Democratic nominee for having “won” the popular vote in yesterday’s US presidential election. In fact, not all the votes have been counted, but it appears very likely that on Nov. 8, 2016, more Americans voted for Hillary Clinton than Donald Trump.

And yet Donald Trump was elected the next president of the United States.

Not only is this possible, it has happened four times before—most notably in 2000, when Al Gore beat George Bush in the popular vote, but lost the election when a Florida recount went against him.

Here are the results from the Associated Press as of 11:47 am US Eastern time:

How did this happen? The electoral college.

Each state has a certain number of electoral college votes for president. All of those votes go to the popular vote winner in that state. So in Florida, for example, Trump was able to win all of the state’s 29 electoral votes with just 49% of the popular vote. Meanwhile in New York, Clinton won 29 electoral votes with 64% of the popular vote. Winning by a larger margin didn’t earn Clinton any more electoral votes.

This counter-intuitive result was not completely unexpected, based on polling. In its final pre-vote election forecast, 538 projected a 10.5% chance that Clinton would win the popular vote, but lose the election.

Because of the way the electoral college works, this was a more likely outcome for Clinton than Trump. Clinton’s popularity in large cities of otherwise red states increased her chances of winning the popular vote, but still losing the election. The polling site 538 projected only a 0.5% chance that the same thing would happen to Trump.

This result is, arguably, bad for everybody. Clinton supporters will be likely to perceive the loss as a failure of democracy. Republicans will be forced to govern without a clear mandate. (Though their victories in both the House and the Senate might help.)

At this point, understanding how this happened is going to be cold comfort for Clinton supporters. In fact, it is likely to only make the entire process all the more dispiriting. More Americans voted for Hillary Clinton, but their president will be Donald Trump.