United States President Donald Trump fired acting US attorney general Sally Yates on Monday, after she refused to defend his executive order introducing temporary immigration restrictions on seven Muslim-majority countries.

Although the measure is drawing growing domestic and international opposition, Trump has defended his clampdown by saying it is necessary to keep “bad dudes” out of the US.

Trump asserts that he put the executive order in place “to put the safety of Americans first” and it’s clear he has strong support from his base of US supporters and some international supporters, too.

Nonetheless, even Republicans have criticised the botched nature of the measure’s implementation in recent days, as well as the apparently subpar vetting it received. The episode is threatening to damage the reputation of the US — so-called “Brand America” — internationally.

Outside of this specific immigration issue, which Trump asserts is not a “Muslim ban”, Brand America is especially likely to take a battering if Trump continues with the undiplomatic pronouncements he regularly espoused during his campaign.

One example is his assertion last week that he will build a border wall with Mexico and that Mexico will pay for it. Trump’s outbursts have prompted Mexican President Enrique Peña Nieto to cancel his forthcoming meeting with the US president.

These Mexican and Muslim controversies, however, are only two examples of a string of wider foreign policy indelicacies. For instance, Trump has said Washington should withdraw US troops from South Korea and Japan and allow those countries to develop nuclear arsenals. This is a policy that not only flies in the face of US policy over decades but also drew swift retorts from both countries.

Much will now depend on whether Trump continues to adopt the sometimes more conciliatory language he has largely adopted since he was elected or whether the wild rhetoric and policy ideas of his campaign return on a full-time basis. If the latter prevails, anti-US sentiment is likely to spike again, in some countries for the first time since George W Bush’s presidency.

This could undercut much of the work former president Barack Obama undertook to turn around perceptions of the country in his eight years in office. Obama began his presidency during a time in which anti-US sentiment was at about its highest level since at least the Vietnam War. The key factor driving this was the international unpopularity of the Bush administration’s foreign policies in the so-called “war on terror”.

His team did much to reverse public opinion patterns and the “Obama effect” was estimated to have raised the value of Brand America by $2.1-trillion in the first year of his presidency, according to a research study by Anholt-GfK Roper Nation Brands Index, which uses the same tools consultants use to value corporate brands.

This reflected the substantial increase in foreigners regarding the US as the most admired country in the world again. This turnaround in fortunes was not only welcomed in Washington but also by Corporate America, following concerns during the Bush years that US-headquartered multinationals were becoming a focus for commercial backlash from anti-Americanism.

But despite these successes, Obama’s progress was uneven. Perhaps the biggest failure of his global public diplomacy was toward what he called the Islamic world.

For instance, despite the early promise of his Cairo speech during his first term, in which he sought to reset US relations with Muslim-majority countries, there remain pockets of extremely high anti-American sentiment in several key states. This includes countries such as Pakistan and Egypt, which Obama failed to address substantially, as Pew Global Research surveys have shown in recent years.

Although audiences across much of the globe criticised Trump during his campaign, it is in the so-called Islamic world where the potential risks could be highest. Many internationally are concerned about Trump’s sabre-rattling call for a fundamentally different military strategy — including carpet bombing — in the campaign against terrorism, which appears to involve intensification of US military commitments in the Middle East.

Moreover, his immigration clampdown has echoes of his previous rhetoric to “shut down” US immigration by Muslims completely, which was widely condemned, even by US Vice-President Mike Pence.

In this context, it appears possible that global opinion could be even more hostile towards Trump than Bush, highlighting the downside risks for Brand America, particularly in Muslim-majority countries. Indeed, at the very time when many say the US should redouble its efforts to win the battle for “hearts and minds” in these states, the president has all the makings of a potential diplomatic disaster.

This risk is heightened by the fact that foreign audiences favoured Hillary Clinton in November’s election. She was the standout winner in last year’s poll of nearly 50 000 people in 45 countries covering 75% of the world by WIN/ Gallup International Association. The survey found Clinton was favoured (often strongly) over Trump in all but one country, Russia.

The WIN/Gallup poll results were similar to those in a Handelsblatt survey last year, in which around 20 000 people in G20 countries wanted Clinton. Once again, Russia was the only state in which Trump triumphed.

Taken overall, Trump has the potential to be one of the least popular US presidents overseas. Whereas Brand America rebounded under Obama, there are now significant downside risks for the US image internationally, especially if the president returns on a permanent basis to the wild rhetoric and policy positions of his campaign.

Andrew Hammond is an associate at the Centre for International Affairs, Diplomacy and Strategy at the London School of Economics.