Isis is under pressure in Mosul and Raqqa, but it is jubilant at the election of Donald Trump.

Abu Omar Khorasani, an Isis leader in Afghanistan, is quoted as saying that “our leaders were closely following the US election, but it was unexpected that the Americans would dig their own graves.” He added that what he termed Trump’s “hatred” towards Muslims would enable Isis to recruit thousands of fighters.

The Isis calculation is that, as happened after 9/11, the demonisation and collective punishment of Muslims will propel a proportion of the Islamic community into its ranks. Given that there are 1.6 billion Muslims – about 23 per cent of the world’s population – Isis and al-Qaeda-type organisations need to win the loyalty of only a small proportion of the Islamic community to remain a powerful force.

Blood-curdling proposals for the persecution of Muslims played a central role in Trump’s election campaign. At one moment, he promised to stop all Muslims from entering the US, though this was later changed to “extreme vetting”. The use of torture by water-boarding was approved and applauded, and Hillary Clinton was pilloried for not speaking of “radical Islamic terrorism”.

World reaction to President Trump: In pictures Show all 29 1 /29 World reaction to President Trump: In pictures World reaction to President Trump: In pictures London, England AP World reaction to President Trump: In pictures London, England Reuters World reaction to President Trump: In pictures Manila, Philippines Getty Images World reaction to President Trump: In pictures Manila, Philippines Getty World reaction to President Trump: In pictures Mosul , Iraq Getty World reaction to President Trump: In pictures Manila, Philippines AP World reaction to President Trump: In pictures New Delhi, India Reuters World reaction to President Trump: In pictures Karachi, Pakistan EPA World reaction to President Trump: In pictures Jakarta, Indonesia Reuters World reaction to President Trump: In pictures Lagos, Nigeria AP World reaction to President Trump: In pictures Kabul, Afghanistan AP World reaction to President Trump: In pictures Jerusalem. Israel Reuters World reaction to President Trump: In pictures Moscow, Russia Reuters World reaction to President Trump: In pictures Seoul, South Korea AP World reaction to President Trump: In pictures Lagos, Nigeria AP World reaction to President Trump: In pictures Peshawar, Pakistan EPA World reaction to President Trump: In pictures Jakarta, Indonesia Reuters World reaction to President Trump: In pictures Hyderabad, India AP World reaction to President Trump: In pictures Kolkata, India AP World reaction to President Trump: In pictures Sydney, Australia Getty World reaction to President Trump: In pictures Sydney, Australia AP World reaction to President Trump: In pictures Aleppo, Syria Reuters World reaction to President Trump: In pictures Mexico City, Mexico AP World reaction to President Trump: In pictures Port-of-Spain, Trinidad and Tobago Reuters World reaction to President Trump: In pictures Jerusalem, Israel EPA World reaction to President Trump: In pictures Baghdad, Iraq Rex World reaction to President Trump: In pictures Gaza Strip, Palestinian Territories Rex World reaction to President Trump: In pictures Tokyo, Japan Rex World reaction to President Trump: In pictures Mexico City, Mexico Getty

Trump and his aides may imagine that much of this can be discarded as the overblown rhetoric of the campaign, but Isis and al-Qaeda propagandists will make sure that Trump’s words are endlessly repeated with all their original venom intact.

Nor will this propaganda about the anti-Muslim bias of the new administration be so far from the truth, going by the track record of many of the people in its security and foreign policy team. Trump is reported to have offered the post of National Security Adviser to General Michael Flynn, who was sacked by President Obama as head of the Defence Intelligence Agency in 2014. Flynn notoriously sees Islamic militancy not only as a danger, but as an existential threat to the US. He tweeted earlier this year that “fear of Muslims is RATIONAL”.

There is an obsessive, self-righteous quality to Flynn’s approach that led him to join chants of “lock her up” in reference to Hillary Clinton during election rallies. Former associates complain of Flynn’s political tunnel vision that could wreak havoc in the Middle East. His consulting company, the Flynn Intel Group, appears to lobby for the Turkish government and Flynn recently wrote an article calling for all-out US support for Turkey, who Washington has been trying to stop launching a full scale invasion of Syria and Iraq. Unsurprisingly, the Turkish president welcomed Trump’s election with enthusiasm and sharply criticised protests against it in the US (something that would be swiftly dealt with by police water cannon in Turkey).

A striking feature of the aspirants for senior office under Trump is a level of personal greed high even by the usual standards of Washington. Trump famously campaigned under the slogan “Drain the Swamp” and castigated official corruption, but it is turning out that the outflow pipe from swamp is the entry point of the new administration.

One grotesque example of this is Rudy Giuliani, who exploited his fame as mayor of New York at the time of 9/11 to earn millions in speaking fees and consultancy for foreign governments and companies. Apparently, none were too dubious for him to turn down. In 2011 and 2012 he reportedly made speeches defending the sinister Iranian cult-like movement, the Mojahideen e-Khalq, that had been on the State Department’s list of terrorist organisations.

Isis 'teaching children how to kill and make bombs'

Giuliani is a swamp creature if ever there was one, yet this week he was publicly turning down the post of Attorney General and was, at the time of writing, being considered for the post of Secretary of State.

Isis and al-Qaeda may underestimate the degree to which they will benefit from Trump’s election, which came at a bleak moment in their fortunes. He and his henchmen have already frightened and enraged hundreds of millions of Muslims and vastly expanded the constituency to which the jihadis can appeal.

A clampdown against them that, in practice, targets all Muslims plays straight into their hands. What made 9/11 such a success for Osama bin Laden was not the destruction of the Twin Towers, but the US military reaction that produced the wars in Afghanistan and Iraq. This could happen again.

There are other potential long-term gains for the beleaguered Isis leader Abu Bakr al-Baghdadi, whatever the outcome of the siege of Mosul. The Taliban, al-Qaeda and Isis are all militarised fanatical movements born out of the chaos of war in Afghanistan and Iraq, and they are flourishing in similarly anarchic conditions in Syria, Libya, Yemen, Somalia and beyond.

In theory, Trump is a non-interventionist; opposed to US military involvement in the Middle East and North Africa, he wants to bring the war in Syria to an end. But he has simultaneously opposed the agreement with Iran on its nuclear programme and criticised Barack Obama for pulling the last US troops out of Iraq in 2011 (though in fact this was under an agreement signed by George W Bush).

But Bush and Obama were both non-interventionists when first elected – until the course of events, and the enthusiasm of the Washington foreign policy establishment for foreign military ventures, changed all that.

The US army and air force is today heavily engaged in Iraq and Syria and that is not going to end with Obama’s departure. In contradiction to Trump’s non-interventionism, leading members of his foreign policy team such as John Bolton, the belligerent former US ambassador to the UN, has been advocating a war with Iran since 2003. Bolton proposes carving out a Sunni state in northern Iraq and eastern Syria, a plan in which every sentence betrays ignorance and misjudgements about the forces in play on the ground. As a recipe for deepening the conflict in the region, it could scarcely be bettered.

Iraqi Christians celebrate liberation from Isis Show all 10 1 /10 Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis An Iraqi Christian prepares for the first Sunday Mass at the Church of the Immaculate Conception in Qaraqosh Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi priests hold the first Sunday mass Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi Christian soldiers attend the first Sunday mass at the Grand Immaculate Church since it was recaptured from Islamic State in Qaraqosh Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis An Iraqi Christian soldier holds his weapon during the first Sunday mass Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis An Iraqi Christian soldier lights a candle Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi priests hold the first Sunday mass at the Grand Immaculate Church since it was recaptured from Islamic State Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi priests hold the first Sunday mass Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi Christian soldiers attend the first Sunday mass at the Grand Immaculate Church since it was recaptured from Islamic State in Qaraqosh, near Mosul in Iraq October 30, 2016. REUTERS/Ahmed Jadallah - RTX2R245 Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis An Iraqi Christian soldier attends the first Sunday mass at the Grand Immaculate Church since it was recaptured from Islamic State in Qaraqosh, near Mosul in Iraq October 30, 2016. REUTERS/Ahmed Jadallah - RTX2R256 Reuters Iraqi Christians celebrate liberation from Isis Iraqi Christians celebrate liberation from Isis Iraqi Christian soldiers attend the first Sunday mass at the Grand Immaculate Church since it was recaptured from Islamic State in Qaraqosh, near Mosul in Iraq October 30, 2016. REUTERS/Ahmed Jadallah - RTX2R269 Reuters

There have always been crackpots in Washington, sometimes in high office, but the number of dangerous people who have attached themselves to the incoming administration may be higher today than at any time in American history.

For instance, one adviser to the Trump national security transition team is, according to Shane Harris and Nancy Youssef of The Daily Beast, one Clare Lopez, author of a book called See No Sharia, which says that Islamists and the Muslim Brotherhood in particular have infiltrated the White House and the FBI, as well as the US Departments of State, Justice, Defence and Homeland Security. Lopez believes that terrorists caused the 2008 financial crash by short-selling stocks.

Optimists have been saying this week that Trump is less ideological than he sounds and, in any case, the US ship of state is more like an ocean liner than a speedboat making it difficult to turn round. They add privately that not all the crooks and crazies will get the jobs they want.