President Obama spent much of his last year in office rejecting a dystopian view of America painted by Republicans. Embedded in Donald Trump’s promise to make America great again was a dark portrayal of how the rest of the world now sees the United States: vulnerable, weak and disrespected.

But surveys of global opinion show no major fall-off in perceptions of American power over the past seven years. Indeed, the data points to a dramatic upward shift in America’s reputation during the Obama years.

America’s global popularity rises under Obama presidency Favorable views of the United States rose from a median of 51 percent in George W. Bush's final year in office to 66 percent during President Obama's final two years, according to Pew Research Center surveys of 30 countries at both time periods. Percent of adults in each country who have a favorable view of the United States 2015 to 2016 2007 to 2008 Obama Bush 89 Ghana Kenya 87 84 Kenya 84 S. Korea 81 Israel Ghana 80 Israel 78 72 Japan S. Korea 70 68 Chile 66 Median 57 Germany Chile 55 54 Malaysia Median 51 Lebanon 51 50 China Japan 50 Russia 46 China 41 39 Lebanon Germany 31 29 Turkey Malaysia 27 22 Pakistan Pakistan 19 Jordan 19 15 Russia 14 Jordan Turkey 12 Note: Results displayed are for the final survey available during each president's administration (2007 to 2008 and 2015 to 2016). Source: Pew Research Center Global Attitudes Project CHRIS ALCANTARA/THE WASHINGTON POST America’s global popularity rises under Obama presidency Favorable views of the United States rose from a median of 51 percent in George W. Bush's final year in office to 66 percent during President Obama's final two years, according to Pew Research Center surveys of 30 countries at both time periods. Percent of adults in each country who have a favorable view of the United States 2007 to 2008 2015 to 2016 Bush Obama 89 Ghana Kenya 87 84 Kenya 84 South Korea 81 Israel Ghana 80 Israel 78 72 Japan South Korea 70 68 Chile 66 Country median 57 Germany Chile 55 54 Malaysia Country median 51 Lebanon 51 50 China Japan 50 Russia 46 China 41 39 Lebanon Germany 31 29 Turkey Malaysia 27 22 Pakistan Pakistan 19 Jordan 19 15 Russia 14 Jordan Turkey 12 Note: Results displayed are for the final survey available during each president's administration (2007 to 2008 and 2015 to 2016). Source: Pew Research Center Global Attitudes Project CHRIS ALCANTARA/THE WASHINGTON POST

It’s hard now to remember just how much antagonism the United States faced across the globe in 2008: People in other countries blamed America for the Iraq war, which undermined support for the war on terrorism. They focused on prisoner treatment at the Abu Ghraib prison in Iraq and talked about America’s negative impact on their own countries.

In the final year of George W. Bush’s presidency, his abysmal approval ratings at home were matched by the opinions of those abroad.

As a candidate, Obama’s promise was to change all that. Almost eight years on, global opinion surveys suggest that, to some degree, he has.

A change in opinion

When the Pew Research Center conducted surveys across 30 countries during Bush’s final two years in office, an average of less than 3 in 10 people expressed confidence in Bush. Months later, during Obama’s first year in office, more than 6 in 10 expressed such confidence.

That initial surge of approval has barely dipped in the years since — with an average of 61 percent rating Obama positively during the last two years of his presidency in the same countries polled by Pew toward the end of Bush’s term. But Obama’s popularity and shifts in rhetoric and policy appear to have pulled up global opinion of the United States as a whole.

In 2015 and 2016, an average 60 percent of people throughout the world surveyed by Pew had a favorable opinion of the United States, compared with 49 percent in Bush’s final two years in office.

The change in opinion has been sharpest in Western Europe. And Germany in particular shows how dramatic that shift has been.

From 2000 to 2008, the share of Germans who viewed the United States favorably fell by more than half, from 78 to 31 percent. Roughly 7 in 10 Germans wanted the United States to remove troops from Iraq in 2007, and in Bush’s final year only 14 percent said they had confidence in his leadership.

Asked to describe this period, Germany’s current ambassador to the United States, Peter Wittig, was tactful. “There are many positive things people in Germany associate with Americans,” he said. “But in the era of W. Bush, it was mostly, how can I say, overshadowed by the Iraq war.”

In the lead-up to the war, hundreds of thousands took to the streets to protest in Berlin and other cities.

“Blood for Oil,” screamed the cover of Germany’s influential Der Spiegel magazine.

Twice, lawyers filed suits in German courts, trying to prosecute then-Defense Secretary Donald H. Rumsfeld on war crimes.

Even the new American embassy opening in Berlin in 2008 became an opportunity for anti-American bashing, with one German paper calling the upper floors of the embassy the “wellness and waterboarding Area.”

Opinions plummeted in other Western countries. In Britain, favorable ratings of the United States fell from 83 to 53 percent from 2000 to 2008. Similar drops were seen in Spain, France, Poland, Turkey, Japan, Indonesia, Mexico and Argentina. By the end of Bush’s presidency, the only places left where a majority said they had confidence in how U.S. leaders handled global affairs were Israel and seven countries in sub-Saharan Africa.

It was against that backdrop that Obama arrived in Berlin in 2008, in the middle of the presidential campaign; he was a rock star.

An estimated 200,000 people packed into the Tiergarten park in July 2008 for his speech near the base of Berlin’s iconic Victory Column. He promised that if elected president he would put an end to the American unilateralism and cowboy diplomacy that had so incensed Europe. “In Europe, the view that America is part of what has gone wrong in our world . . . has become all too common,” Obama said. “No one nation, no matter how large or powerful, can defeat such challenges alone.”

Trying to explain the emotional reaction of his countrymen back then, Wittig said Obama tapped into something deep in the German psyche.

“You might call it naïve or idealistic,” he said. “But it appealed to their hidden love of America . . . the idea that America could be a force for good.”

“The fact that America could elect an Afro-American. It made America seem avant-garde again. It showed the tremendous strength Americans have,” he said.

In Obama’s first year, Pew found 93 percent of Germans saying they had confidence in his leadership, according to Pew, a number that has slipped slightly, to 86 percent this year.

Views in the Muslim world

That success has not been universal.

Obama has barely made a dent, for example, in how the Muslim world views the United States, and opinions in some of those countries have even worsened.

In Pakistan, for example, 62 percent held an unfavorable view of the United States last year, almost identical to the 63 percent in 2008. And 56 percent said they have little or no confidence in Obama’s leadership in world affairs, slightly below how they rated Bush in his final year. Obama’s use of drone strikes as an anti-terrorism weapon has been widely unpopular.

The last Pew poll available from Egypt in 2014 showed the United States had become even more despised there than during the Bush years. Only 10 percent had a favorable view of the United States in 2013, lower than the 27 percent in 2009 right after Obama took office, and lower than the 22 percent in 2008, Bush’s final year.

Much of the debate in the 2016 presidential campaign focused on America’s standing in the world, with some candidates and voters expressing worry that the nation’s global power had declined. Most of the rest of the world perceived no such fall-off.

When a 2016 Pew survey of 15 countries asked whether America’s importance and power has changed in the past decade, a median 41 percent said the United States is similarly powerful as before, while 33 percent said it is less powerful and 20 percent saw it as more powerful.

When it comes to China, global opinion reflects China’s rising influence. A median of 43 percent said the United States is still now the world’s leading economic power, while 35 percent said China is. With the United States economy’s gradual recovery and China’s growth rates slowing, the percentage naming the United States as the world’s top economy has risen.