President Trump listens as he and NATO Secretary General Jens Stoltenberg participate in a news conference in the East Room of the White House on April 12. (Jabin Botsford/The Washington Post)

Addressing the United Nations last fall, President Barack Obama took a moment to highlight for fellow world leaders what he called “the most important fact” about the state of global affairs: Human existence on planet Earth is good — and getting better.

War is down, he said, while life expectancy is up. Democracy is on the march, and science has beaten back infectious diseases. A girl in a remote village can download the “entirety of human knowledge” on a smartphone.

A person born today, Obama concluded, is more likely to be safer, healthier, wealthier and better-educated — and to see a path to prosperity — than at “any time in human history.”

President Trump does not inhabit this world.

To Trump, the world is “a mess,” as he said during a White House news conference this week with NATO Secretary General Jens Stoltenberg.

(Victoria Walker/The Washington Post)

In recent days, Trump authorized missile strikes on Syria, shifted rapidly to a tougher tone with Russia, and negotiated with China’s authoritarian leader over what to do about North Korea’s nuclear weapons program.

“It’s crazy what’s going on,” Trump said. “Whether it’s the Middle East or you look at — no matter where — Ukraine — whatever you look at, it’s got problems, so many problems.”

“Right now,” he concluded, “it’s nasty.”

What a time to be alive.

To ordinary Americans, the gulf between the worldviews of the United States’ two most recent leaders could not be more vast.

But historians and foreign affairs analysts said that, despite their apparent contradictions, both things can be true. The world is always a mess. Bad things happen. There are crises. People die.

The question, they said, is how a president responds to the mess and how he frames the threat and the response to the public — a challenge made more difficult in an age of immediate and nonstop news from across the world.

“President Obama constantly reminded us that our own times are not uniquely oppressive,” said Douglas Brinkley, a presidential historian and author at Rice University. “There’s a feeling due to the 24-7 news cycle that everything is a crisis mode, when the fact of the matter is, Americans have it better now than ever before.”

Throughout his campaign, Trump railed about the dangers and threats to Americans: inside the country in the form of undocumented immigrants and violent inner cities, and abroad in the form of Islamic State terrorists, swarms of refugees and rapacious U.S. trading partners.

Time and again, Obama sought to counter Trump’s apocalyptic rhetoric by putting the purported threats in broader context and cautioning Americans not to succumb to fear or anger.

The Islamic State does not represent an “existential threat” to the country, Obama said in November 2015, just a few days after Islamic State terrorists killed 130 people in Paris. Rather, he said, they were nothing more than “a bunch of killers with good social media.”

Obama characterized most undocumented immigrants as hard-working strivers. Globalization caused discomfort for some workers, Obama acknowledged, but he was quick to emphasize the opportunities it provided for American ingenuity in new markets overseas.

“Yes, we’re going through large, structural changes . . . [and] all these things are creating a new politics for the world,” said Simon Rosenberg, founder of NDN, a liberal think tank in Washington. “The challenge is not to be overwhelmed but to manage them for one’s own benefit. That’s where Trump is so flummoxed. He is more fearful of the changes than he is understanding the goal of the president is to manage them for the benefit of the United States.”

That might have been Obama’s goal, but the president recognized during his final year in office that his optimistic message to Americans was at risk of being overtaken by the chaotic images from abroad.

During a town hall-style event with young people in Malaysia in September, Obama said that the flow of information bombarding news consumers on televisions, computers and smartphones makes it appear “as if the world is falling apart.”

A war here, an environmental disaster there, and suddenly “everybody is shouting and everybody hates each other,” Obama said. “And you get kind of depressed. You think, ‘Goodness, what’s happening?’ ”

But, Obama emphasized, “if you had a choice of when to be born and you didn’t know ahead of time who you were going to be — what nationality, whether you were male or female, what religion — but you had said, ‘When in human history would be the best time to be born?’ — the time would be now.”

Steven Pinker, a psychology professor at Harvard University, has written that voluminous data back up Obama’s argument. But he acknowledged that the former president’s message did “fail to resonate” during a rapid-fire campaign news cycle.

“He has the facts behind him, but to get those facts, you can’t read the daily news,” Pinker said. “If you only look at bad things, there are always bad things. Trump is right that there is a lot of nasty stuff going on. There always is, and unfortunately there probably always will be. The question is, is there more nasty stuff? The answer is no.”

Unlike Obama, Trump is a voracious consumer of breathless, hyperbolic cable news programming. In the White House, he has continued to react, on Twitter, to the partisan debate and unfolding horrors on his television screen.

His message has consistently been that America is being taken advantage of because of Obama’s weakness. China and Mexico are beating the United States on trade. Middle Eastern refugees are flowing across borders, causing chaos and crime. Immigrants are taking American jobs. “We don’t win anymore,” Trump said repeatedly.

In his inaugural address, Trump described in stark terms problems he saw across the country as he began his presidency and said, “This American carnage stops right here and stops right now.”

To historian Rick Shenkman, author of “Political Animals: How Our Stone-Age Brain Gets in the Way of Smart Politics,” Trump’s rhetoric appeals to base human instincts, hard-wired from prehistoric times, to be on guard for constant threats.

While some critics have suggested Trump exploits public fears, Shenkman believes he more effectively leverages public anger.

“People who are in an angry mood want change,” he said. “They will take risks for change . . . Modern political parties, and Trump in particular, have learned that if you keep people in a state of nonstop anger, they stand by you.”

Yet historians said Trump, like other presidents, would have to shift to a more upbeat message as his presidency matures. “A presidency can’t feed on failure,” Brinkley said.

Others suggested that Trump’s recent pivot away from some of his foreign policy positions from the campaign — such as calling NATO “obsolete” and threatening to label China a “currency manipulator” — reflects a leader coming to terms with how complicated the world is and how difficult it will be to address the global challenges without allies and partners now that he is in charge.

“Right now, there is a fear, and there are problems — there are certainly problems,” Trump said at the White House. “But ultimately, I hope that there won’t be a fear and there won’t be problems, and the world can get along. That would be the ideal situation.”