President Trump Donald John TrumpOmar fires back at Trump over rally remarks: 'This is my country' Pelosi: Trump hurrying to fill SCOTUS seat so he can repeal ObamaCare Trump mocks Biden appearance, mask use ahead of first debate MORE's election led former President Obama to question his judgment of the American people and compare Trump to a cartoon, according to an upcoming memoir by a longtime Obama aide.

In, "The World as It Is," former aide Ben Rhodes writes that shortly after Trump won, Obama was at times optimistic and other times frustrated with the results.

According to an excerpt obtained by The New York Times, Obama sent Rhodes a message saying “There are more stars in the sky than grains of sand on the earth,” as he worked to cheer up staff over the election results.

But on another occasion, Obama questioned the American people.

ADVERTISEMENT

"Maybe this is what people want. I’ve got the economy set up well for him. No facts. No consequences. They can just have a cartoon,” he said. "We’re about to find out just how resilient our institutions are, at home and around the world.”

He also asked on a trip to Peru a few weeks after the election: "What if we were wrong?"

"Maybe we pushed too far. Maybe people just want to fall back into their tribe," Obama said.

Trump's election win in 2016 shocked many after pollsters widely predicted that Democratic candidate Hillary Clinton Hillary Diane Rodham ClintonButtigieg stands in as Pence for Harris's debate practice Senate GOP sees early Supreme Court vote as political booster shot Poll: 51 percent of voters want to abolish the electoral college MORE would win the election.

A week before voting day, one election model forecasted Clinton winning 332 electoral votes to Donald Trump’s 206. The final results saw Trump winning 304 votes to Clinton's 227.

In his memoir, Rhodes writes that he should have predicted that outcome.

"I couldn’t shake the feeling that I should have seen it coming,” Rhodes writes. “Because when you distilled it, stripped out the racism and misogyny, we’d run against Hillary eight years ago with the same message Trump had used: She’s part of a corrupt establishment that can’t be trusted to bring change.”