When IS launched its lightning offensive in northern and western Iraq in June, Iran moved swiftly by arming Iraqi Kurdish fighters and supporting Baghdad with military advisers.
It has also provided training for Shiite militias engaged in a counter-offensive against the Sunni extremist group.
But it has consistently denied having troops on the ground and was never invited to join the US-led military coalition assembled against IS, dismissing allied air strikes in Iraq and Syria as ineffective and aimed only at serving Western interests.
"Without awaiting anything in return, Iran is doing all it can to help the Iraqi people as a humanitarian and Islamic duty to eliminate terrorism in that country," military Deputy Chief of Staff General Massud Jayazeri was quoted by Iran's Arabic-language Al-Alam television as saying Thursday.
The Pentagon said this week that Iranian F-4 Phantom jets -- acquired from the United States before the 1979 Islamic revolution -- had started attacking IS fighters in eastern Iraq's Diyala province, on the Iranian border.
Tehran refused to confirm or deny that.
"There has been no change to Iran's policy to provide support and advice to Iraqi officials in the fight" against IS, foreign ministry spokeswoman Marzieh Afkham said.
Lebanon's Tehran-backed Shiite movement Hezbollah says an Iranian elite unit commander has been at the forefront of the counter-attack in Iraq after the IS advances.
Major General Qassem Suleimani landed in Baghdad on June 10, hours after IS overran the city of Mosul, "leading a group of Lebanese and Iranian military experts," Hezbollah's Al-Manar website said.
Suleimani, who heads Iran's elite Quds Force, jointly worked out with the Iraqi military and Shiite militias a strategy "to secure Baghdad and its surroundings," at a time when the jihadists appeared unstoppable.
In early October, Iranian media published several photographs of the general standing alongside Iraqi Kurdish fighters, army officers and Shiite militia members.
Signup to our newsletter and follow us on Facebook and Twitter!
Iran's ties with Iraq have been transformed since the 2003 ouster of dictator Saddam Hussein that resulted in power in Baghdad being transferred from Sunnis to the majority Shiites.
Predominantly Shiite Iran has a strong interest in defending Iraq, where IS's declared aim is to topple a regime dominated by Shiites, whom the jihadists regard as heretics.
"They are scared," a Western diplomat posted in Tehran told AFP.
He noted that the Islamic republic has reinforced border defences and vowed to attack the jihadists "deep inside Iraqi territory" if they should dare to approach its territory.
Another diplomat said Iran cannot officially announce it has initiated air strikes when Tehran has condemned the US-led coalition as ineffective without a ground component.
Historic enemies, Tehran and Washington deny any military cooperation despite finding themselves on the same side in the war against IS, the diplomat said.
However, he said Iraq is acting as an intermediary to ensure that operations carried out by one do not interfere with those of the other.
Regarding Syria, meanwhile, Iran is a long-time ally of President Bashar al-Assad, whose Alawite sect is an offshoot of Shiite Islam. Tehran has sworn to stand by Assad in the civil war that has raged for nearly four years and in which IS is a major threat to him.
While denying it has any troops on the ground in Syria, Iran has acknowledged sending military advisers to help the regime. Hezbollah fighters have also openly played a key role in recapturing rebel-held towns.