President Trump is adding further venom to the raging sectarian hatreds tearing apart Iraq and Syria by his latest ill-judged tweets. These have far greater explosive potential than his better known clashes with countries like Australia and Mexico, because in the Middle East he is dealing with matters of war and peace. In this complex region, the US will have to pay a high price for switching to a vaguely belligerent policy which pays so little regard to the real situation on the ground.

In one tweet this week, Trump says that “Iran is rapidly taking over more and more of Iraq even after the US has squandered three trillion dollars there. Obvious long ago!” In fact, it is not obvious at all because it is not true. Iran was in a stronger position in Iraq before June 2014 when the Isis offensive captured Mosul, defeated the Iraqi army and provoked the fall of the government of Nouri al-Maliki who was close to Iran.

The victories of Isis at that time led to a return of US influence in Iraq as President Obama created a US-led air coalition which has launched thousands of air strikes against Isis. He sent at least 5,000 US military personnel backed by thousands of American contractors who handle training and logistics for the current Iraqi army assault on Mosul. The attack is very much a joint US-Iraqi joint operation and has turned into the hardest fought battle in Iraq since the US invasion of 2003.

The controversial orders Donald Trump has already issued Show all 9 1 /9 The controversial orders Donald Trump has already issued The controversial orders Donald Trump has already issued Trump and the media White House Press Secretary Sean Spicer takes questions during the daily press briefing Getty Images The controversial orders Donald Trump has already issued Trump and the Trans-Pacific Partnership Union leaders applaud US President Donald Trump for signing an executive order withdrawing the US from the Trans-Pacific Partnership negotiations during a meeting in the Roosevelt Room of the White House in Washington DC. Mr Trump issued a presidential memorandum in January announcing that the US would withdraw from the trade deal Getty The controversial orders Donald Trump has already issued Trump and the Mexico wall A US Border Patrol vehicle sits waiting for illegal immigrants at a fence opening near the US-Mexico border near McAllen, Texas. The number of incoming immigrants has surged ahead of the upcoming Presidential inauguration of Donald Trump, who has pledged to build a wall along the US-Mexico border. A signature campaign promise, Mr Trump outlined his intention to build a border wall on the US-Mexico border days after taking office Getty Images The controversial orders Donald Trump has already issued Trump and abortion US President Donald Trump signs an executive order as Chief of Staff Reince Priebus looks on in the Oval Office of the White House. Mr Trump reinstated a ban on American financial aide being granted to non-governmental organizations that provide abortion counseling, provide abortion referrals, or advocate for abortion access outside of the United States Getty Images The controversial orders Donald Trump has already issued Trump and the Dakota Access pipeline Opponents of the Keystone XL and Dakota Access pipelines hold a rally as they protest US President Donald Trump's executive orders advancing their construction, at Columbus Circle in New York. US President Donald Trump signed executive orders reviving the construction of two controversial oil pipelines, but said the projects would be subject to renegotiation Getty Images The controversial orders Donald Trump has already issued Trump and 'Obamacare' Nancy Pelosi who is the minority leader of the House of Representatives speaks beside House Democrats at an event to protect the Affordable Care Act in Los Angeles, California. US President Donald Trump's effort to make good on his campaign promise to repeal and replace the healthcare law failed when Republicans failed to get enough votes. Mr Trump has promised to revisit the matter Getty Images The controversial orders Donald Trump has already issued Donald Trump and 'sanctuary cities' US President Donald Trump signed an executive order in January threatening to pull funding for so-called "sanctuary cities" if they do not comply with federal immigration law AP The controversial orders Donald Trump has already issued Trump and the travel ban US President Donald Trump has attempted twice to restrict travel into the United States from several predominantly Muslim countries. The first attempt, in February, was met with swift opposition from protesters who flocked to airports around the country. That travel ban was later blocked by the Ninth Circuit Court of Appeals. The second ban was blocked by a federal judge a day before it was scheduled to be implemented in mid-March SANDY HUFFAKER/AFP/Getty Images The controversial orders Donald Trump has already issued Trump and climate change US President Donald Trump sought to dismantle several of his predecessor's actions on climate change in March. His order instructed the Environmental Protection Agency to reevaluate the Clean Power Plan, which would cap power plant emissions Shannon Stapleton/Reuters

But Trump is not the only person saying that Iraq is increasingly controlled by Iran. Isis continually maintains that the majority Iraqi Shia community, which makes up about two thirds of the 33 million Iraqi population, is not really Iraqi but Iranian. Isis has always demonised the Iraqi Shia as religious heretics and “Safavids”, called after the Iranian dynasty, and said they are not real Muslims and deserve to die. Saudi Arabia, with whose rulers Trump recently had a long conversation, holds somewhat similar views about equating Shia Islam with Iran and the need to combat both.

Trump’s claim about growing Iranian control of Iraq might be dismissed as nonsense without long term consequences. But there are other arrows pointing in the same direction: Iraqis, Iranians and others in the region are pointing to the bizarre make-up of the list of seven states whose citizens have been temporarily banned from entering the US. This is supposedly directed against al-Qaeda and Isis, drawing on lessons learned after 9/11. But none of the states from which the hijackers came – Saudi Arabia, United Arab Emirates, Egypt and Lebanon – are subject to the ban as are Iraq and Iran. “The list looks like its intent is basically anti-Shia,” says one observer in Baghdad and the governments of Saudi Arabia and Turkey seem to think the same thing, since they have either supported or failed to condemn the US action, though it is more or less openly directed against Muslims.

The Trump administration seems to think in tweets and slogans, so it is probably wrong to speak of a coherent change in policy. But in its first weeks in office, it has been far more vocal about confronting a supposed Iranian threat than it has about eliminating Isis. This came across clearly on Wednesday when the national security adviser, General Michael Flynn, once head of the Defence Intelligence Agency until sacked by Obama, accused Iran of conducing a “provocative” nuclear missile test in breach of a UN Security Council resolution and helping Houthi rebels in Yemen, saying “as of today we are putting Iran on notice”. The phrase about Iran was repeated in a tweet by Trump, indicating a greater concern in the White House about Iran than Isis and little interest in the titanic battle being waged for control of Mosul. In some secret location in that city, the self-declared caliph Abu Bakr al-Baghdadi, may be pondering the same question that is absorbing other world leaders: how much of what Trump says is just bombast and how far will it turn into reality on the ground? It is a little early to say, but the signs are not encouraging.

Amber Rudd: Donald Trump's travel ban a 'propaganda opportunity' for terrorists

In any case, bombast alone is capable of reshaping the political landscape. Paradoxically, White House actions in the Middle East are creating the very conditions for Iran to displace US influence in Iraq in a way that Trump wrongly imagines has already happened. Responding to the travel ban, the Iraqi parliament declared that US citizens proposing to enter Iraq over the next 90 days should be subjected to the same restrictions. The Prime Minister Haider al-Abadi refused to go along with this, saying it was more important to keep cooperation with the US while the battle for Mosul is still going on.

But the matter is not likely to rest there, because the US relationship with Iran in Iraq has always been a curious mixture of open rivalry and rather more covert cooperation, since they share a common enemy in Isis and, previously, in al-Qaida in Iraq. American power in Iraq has grown since 2014 because it is Iraq’s main military ally. Without US and coalition air strikes, the Iraqi army could not defeat Isis or even hold its own against it. But the US political position in Iraq is weaker than its military one and, thanks to the US travel ban and Trump’s escalating attacks on Iran, it’s going to get weaker still. The ban is a “golden opportunity” for Iran to push back against the US, said a former senior Iraqi official. “Iraqis are very worried,” said Kamran Karadaghi, an Iraqi commentator and former chief of staff to the Iraqi presidency. “If anything bad happens to Iran because of Trump, it will be bad for Iraqis.”

In pursuit of an anti-Iranian line, the Trump administration is making the same mistake as that made by Western governments after the 2011 uprisings in the Arab world. They tended to think in terms of nationalism, nationalities and the nation state, but in the Middle East these count for less as communal bonds than religious identity. Thus, what was essentially a Sunni Arab uprising in Syria six years ago changed the balance of power between Sunni and Shia in Iraq and restarted the civil war there. The threat to President Bashar al-Assad and his Alawite dominated government was bound to lead to the Shia in Iran, Iraq and Lebanon rallying to his support to prevent his overthrow, because they felt that was an existential threat to themselves.