The United States and Iran are moving rapidly to defend Iraq from rampaging Sunni Islamist insurgents, with Washington urgently considering air strikes on the jihadi militants and Tehran dispatching its foremost powerbroker to help arrange the defence of Baghdad.

Senior US officials told the Guardian that an air campaign was under serious discussion, possibly targeting fighters not just in Iraq but in Syria, where they have seized swaths of territory in the past two years. President Barack Obama said that decisions would be taken in the "days ahead".

Iran, meanwhile, moved to defend its own interests in its western neighbour, sending Major General Qassem Suleimani, an éminence grise of the Iranian revolutionary guards, to Baghdad to meet militia leaders and tribal chiefs in control of the Iraqi capital's vulnerable western approaches.

The scramble by two staunch adversaries to shore up the embattled Iraqi authorities underscored how seriously they take the situation in a country in danger of fragmentation as a result of this week's sudden advance by fighters from the Islamic State of Iraq and the Levant (Isis).

The jihadi grouping, consisting of no more than 7,000 men, has upended regional calculus this week, seizing key Iraqi cities and towns in the north, sending the army fleeing as they sweep south to within 50 miles of the capital. Hundreds of thousands of Iraqis are on the move, seeking safe haven. The UN has warned that the Isis fighters have committed summary executions and rape on their irresistible advance.

The next big town in their way is Samarra, known for its Shia shrines. Units of Shia militia were escorted north from Baghdad to defend its holy sites. Fighting was reported in and around the city on Friday. Witnesses said the shrines remained undamaged and that the insurgents had not been threatening residents. "Some of them have long hair and they are carrying black flags," said one man. "They are Arabs from other countries."

Hours later a statement from Grand Ayatollah Ali al-Sistani, Iraq's most influential Shia cleric, read to his followers at Friday prayers in Kerbala, urged them to take up arms against the Sunni insurgents. "People who are capable of carrying arms and fighting the terrorists in defence of their country … should volunteer to join the security forces to achieve this sacred goal," the statement said.

External help also looked likely, following the latest comments from Obama and other administration officials. The president has ruled out sending US soldiers and marines back to the Iraqi streets they patrolled from 2003 to 2011, but signalled a new, reluctant openness to returning the US to war in Iraq.

Isis "could pose a threat eventually to American interests as well", Obama said in a televised address. He vowed not to be "dragged back into a situation in which, while we're there keeping a lid on things, and after enormous sacrifices by us, as soon as we're not there, people end up acting in ways that are not conducive to the long-term stability and prosperity of the country".

Officials told the Guardian that options under discussion include an air campaign, using either air force or navy warplanes or both. The duration of such a campaign has yet to be determined. Drone strikes remain under consideration, but manned aircraft are said to the preferred option, owing to their superiority against moving and manoeuvrable targets.

Two officials said that a strike at Isis in Iraq and Syria was under consideration. Isis "is now across the border", said a Pentagon official, who requested anonymity. "It is possible to take out the head. You've got to take out the heart … Everything is being looked at."

Suleimani's role remains less clear. The powerful figure, commander of the elite Quds force of the Iranian revolutionary guards, did not meet the beleaguered Iraqi prime minister, Nuri al-Maliki, or Iraqi generals, but the militia leaders likely to play a role in taking the fight to Isis.

The insurgency has emerged as the biggest threat to Iraq's stability since the US withdrawal three years ago. A new humanitarian crisis is unfolding, UN officials have warned. Rupert Colville, the UN human rights spokesman, said that hundreds of people were killed, many of them summarily executed, after Isis overran Mosul on Tuesday.

"We've received reports of the summary execution of Iraqi army soldiers during the capture of Mosul and of 17 civilians in one particular street," Colville said. "There was also the execution of a court employee in the Dawasa area in central Mosul and the execution of 12 people in Dawasa who were believed to have been serving with the Iraq security services or possibly with members of the police."

He said the UN mission had interviewed some of the 500,000 people who fled Mosul. A further 40,000 people were estimated to have fled Tikrit and Samara, according to the International Organisation for Migration.

Iraqi officials who remained in the northern city of Kirkuk, which was seized by Kurdish peshmerga forces on Thursday, said the Kurds were consolidating their presence. "They came to stay," said one police captain on Friday. "They're not going anywhere."

The Kurdish control of Kirkuk, a city coveted by them for centuries, is one of the biggest shifts in a week that has starkly exposed the impotence of the government and the frailty of Iraq's borders.

Kurds, Arabs and Turkmen all expressed a sense that security under the Kurds was better than mayhem under someone else.

"I am happy for the [Kurdish military] peshmerga forces to stay in Kirkuk if they can bring security to the residents," said Mohammed, a Sunni Arab, blaming the Maliki government for a lack of security in the country. "Maliki has filled the prisons with Sunnis and intensified the sectarian tendencies in the society."

But Emma Sky, who ran the governorate of Kirkuk for the transitional government and who now lectures on Iraqi politics at Yale University, believes that the widespread joy at Kurdish control may not remain universal for long.

"While many Kurds will be pleased to see Kirkuk come under the authority of the KRG [Kurdistan regional government], there will be many Arabs who will not be. Within the province itself, the Arabs of Hawija will resent this takeover," she said.