Islamist militants have attacked Iraq's largest oil refinery in the city of Baiji, 155 miles north of Baghdad, as Iran raised the prospect of direct military intervention to protect Shia holy sites.

A top security official told the Associated Press that fighters of the Islamic State in Iraq and the Levant (Isis) had begun their attack on the refinery late on Tuesday night. The attack continued into Wednesday morning, with militants targeting it with mortar shells, starting a small fire on the periphery.

The refinery accounts for more than a quarter of the country's entire refining capacity, all of which goes toward domestic consumption – petrol, cooking oil and fuel for power stations. At the height of the insurgency from 2004 to late 2007, the Baiji refinery was under the control of Sunni militants who used to siphon off crude and petroleum products to finance their operations. Isis has used its control of oilfields in Syria to boost its coffers.

Any lengthy disruption at Baiji risks long lines at the petrol pump and electricity shortages, putting further pressure on the Shia-led government of the prime minister, Nouri al-Maliki. Iraq's beleaguered prime minister has fired several top security commanders after Iraqi troops melted away before Isis militants as they captured the Mosul in the north, Iraq's second largest city.

Jihadi rebel forces have reached Baquba, less than 40 miles north of Baghdad, while fighting continues to rage further north in the city of Tal Afar. State television late on Tuesday aired footage of army troops and armed volunteers disembarking from a transport C-130 aircraft at an airstrip near the city.

Isis and disaffected Sunnis have threatened to march to Baghdad, the capital, and the Shia holy cities of Kerbala and Najaf in the worst threat to Iraq's stability since US troops left. The three cities are home to some of the most revered Shia sites. Isis has tried to capture Samarra, north of Baghdad, home to another major Shia shrine.

Hassan Rouhani, the Iranian president, warned that Iran would do whatever it took to protect the shrines.

"Dear Kerbala, Dear Najaf, Dear Kadhimiya and Dear Samarra, we warn the great powers and their lackeys and the terrorists, the great Iranian people will do everything to protect them," he said, in a speech on Wednesday in Khoramabad, near the Iraqi border.

On Tuesday Rouhani mentioned petitions signed by Iranians who said they were willing to fight in Iraq "to destroy the terrorists and protect the holy sites", which are visited by hundreds of thousands of Iranian pilgrims annually.

"Thank God there are enough volunteer Shias, Sunnis and Kurds in Iraq to fight the terrorists," he added.

Thousands of Iranians have volunteered to defend the shrines. Iran is 90% Shia, a group considered to be apostates by Isis and Sunni extremists. Rouhani said on Saturday that Iran had never dispatched any forces to Iraq and it was very unlikely it ever would, but Qassem Suleimani, commander of the Quds force of the Iranian Revolutionary Guard Corps (IRGC), was in Baghdad last week to give advice to Maliki.

Amid the fighting, the plight of foreign oil workers has become a concern. The Turkish embassy in Baghdad is investigating reports that a group of Turkish construction workers were among 60 people abducted by militants near Kirkuk. Isis seized 15 Turks who were building a hospital near the town of Dour, in Salahuddin province near Kirkuk.

The reported abduction came a week after 80 other Turkish nationals were seized by insurgents in Mosul, 49 of them from the Turkish consulate, including special forces soldiers, diplomats and children.

The Indian government has not been able to make contact with 40 Indian construction workers in Mosul, with the Times of India reporting that they have been kidnapped.

The foreign ministry spokesman, Syed Akbaruddin, said dozens of Indian workers were living in areas overrun by Isis and India was in contact with many of them, including 46 nurses. The nurses are stranded in Tikrit, which is under militant control, with many of them holed up in the hospital where they work. Nurses who spoke to the Indian media said they had been treating people injured in fierce street fighting.

The White House has indicated that it may be some days away from a decision on any US military intervention as senior Democrats expressed growing caution about the risks of being sucked back in to conflict in the country.

Amid signs that Barack Obama is treading warily over calls for air strikes, the administration spokesman, Jay Carney, said the president would "continue to consult with his national security team in the days to come", and there would also be further consultations with members of Congress, including some closed briefings later this week.