Overseas, the Obama years have been defined by spreading disorder and chaos, particularly in the Middle East and North Africa, with nations collapsing and borders dissolving. More terrorist safe havens have been established than ever before. Russia and China have become more aggressive and significantly increased their geopolitical influence. America is now held in brazen contempt by our enemies and mistrusted by many of our allies.

Yet in some respects the greatest failure of the Obama years is in the area where many people thought he would excel. Mr. Obama made the centerpiece of his 2008 campaign a promise to end a politics that “breeds division and conflict and cynicism.” In February of that year, I praised him for “a message that, at its core, is about unity and hope rather than division and resentment.” Yet he leaves office with America more conflicted and cynical than when he took office. More than 70 percent of Americans say the country is either more divided or no more united than it was in 2009. Race relations are the worst in decades, and our nation is as polarized as it has been in the modern era.

It would be silly to lay all the blame for this at the feet of Mr. Obama. Republicans have been rhetorically reckless at times, and President-elect Donald Trump has coarsened public discourse and set Americans against one another in ways that were once unimaginable. But Mr. Obama came first, and he played a role in where we are.

In his farewell address last week, President Obama said that for the sake of our democracy we need to heed the advice of the fictional character Atticus Finch, who said, “You never really understand a person until you consider things from his point of view.”

Yet Mr. Obama never seemed to consider things from a different point of view from his own. He has shown withering disdain for his opponents, constantly impugning their motives even as he testified to the purity of his own. It was his arrogance that proved to be Mr. Obama’s undoing. (Even leaders of his own party felt Mr. Obama’s derision, as if dealing with them was somehow beneath him.) Mr. Obama dismissed those who disagreed with him like a professor forced to deal with simple-minded, wayward students. He warned us against retreating into our bubbles, but he was never able to escape his own.

During the Obama presidency, many people felt unheard and alienated. They are the kind of Americans Mr. Obama had in mind in 2008 when he talked about “bitter” people clinging to their “guns or religion.”

Barack Obama is among the most talented campaigners we have ever seen. But as president, he failed in a manner and on a scale that damaged his party, undermined faith in the institutions of government and left the nation more riven than he found it. For most Americans, the economy has been listless. All this helped create the conditions that allowed a cynical demagogue to rise up and succeed him, one who will undo the achievements he most prizes.

In many ways Barack Obama and Donald Trump could not be more different. Mr. Obama is equable and graceful; Mr. Trump is erratic and graceless. Yet one cannot make sense of the incoming presidency without understanding the failures of the outgoing one.