Hundreds of Iranian soldiers have taken part in a joint operation inside Iraq with Kurdish forces to retake a town held by the Islamic State group, security sources have told Al Jazeera.
It is believed to be the first time that Iranian troops have been directly involved in the fighting against the Sunni rebel group group on this scale.
Hundreds of soldiers crossed the border on Friday in a joint operation with Kurdish Peshmerga forces to take back Jalawla in Diyala province, an official Kurdish source who asked not to be identified told Al Jazeera.
He said the Iranian forces retreated back across the border early on Saturday.
Foreign Ministry spokeswoman Marzieh Afkham dismissed the reports of any Iranian military presence in Iraq.
According to the official IRNA news agency, she said Tehran "has a close watch on field developments in Iraq sensitively with regards to mutual cooperation and international commitments and takes into consideration cooperation with the Iraqi government".
Jalawla, fewer than 30km from the Iranian border, is a strategic point for both Iraq and Iran.
"Previously there had been Iranian assistance with security advisers and Iranian backed militias, but this does seem to the the first time soldiers have been involved," Al Jazeera's Jane Arraf reported from Erbil, capital of the autonomous Kurdish region.
Kurdish officials said their forces had surrounded Jalawla but have so far been unable to advance because of roadside bombs placed by Islamic State fighters.
The Islamic State controls large swaths of land in northern Iraq and neighbouring Syria. The US earlier this month launched air strikes to help Iraqi federal troops and Peshmerga stop the group's advance.
Speaking to Al Jazeera, Reza Marashi from the National Iranian American Council said that the Islamic State group is "making for strange bedfellows".
"The current government in Iraq, the Kurds, the US, Europe, Iran, are all finding common cause and stability because the Islamic State group presents a threat to each of these respective actors.
"In the past Iraq was an area where all of these countries were fighting each other, overtly or covertly. It is very noteworthy that Arab and Western governments are not complaining about Iran being involved as they have the same goal."
Marashi said that Iran and the US would not fight alongside each other but have probably divided tasks.
He also said it was unlikely that Iran would massively increase its presence.
"Traditionally Iran uses money, intelligence and weapons to achieve its objectives. There won't be a massive escalation because there is a fear of mission creep inside Iran."