Baghdad - Iranian military commanders deployed in Iraq played a key role in recent victories against Islamic State of Iraq and the Levant (ISIL) fighters throughout the country, according to Iraqi security officials and Shia militia leaders.

Iran was the first country to respond to the Iraqi government's calls for international help in the battle against ISIL, which overran vast swaths of the country's north and west this summer and were advancing towards the capital.

Dozens of Iranian military commanders - including Qassim Sulaimani, the head of Iran's elite Quds Force - have joined Iraqi security forces in battlefields north and south of Baghdad. Iraqi troops, backed by Shia militias, Kurdish forces and Iranian military commanders, recently regained control of the towns of Jalawla and Saadia in Diyala province.

A few weeks earlier, ISIL was also driven out of the town of Jurf al-Sakhar, a key supply route for southern Baghdad.

RELATED: Iran 'sent soldiers to fight in Iraq'

While Iraqi officials and Shia militia commanders do not deny the participation of Iranian commanders, they described their role as advisory rather than direct combat.

"We have American advisers in Iraq ... and I do not hide that we have Iranian advisers too," Haider al-Abbadi, the Iraqi prime minister, said last week in a televised interview.

"There are Iranian advisers and several of them as well as the American advisers ... started showing up in several military camps to help our troops ... but there are no Iranian fighters, no [Iranian] Revolutionary Guards, no Iranian soldiers and no Basij [forces]," Abbadi said.

Iraqi Shia militia commanders and security officials told Al Jazeera that the participation of the Iranians in Jalawla, Saadia, Jurf al-Sakhar and other battles provided a significant boost.

When they [Iranian advisers] were there in the field, no one stands in our face and magically everything was available, the ammunition, the [intelligence] information, the smooth coordination with the military units and other [Shia] factions and the air force backup. - Abu Sajad al-Saadi, commander of the Abu al-Fadhil al-Abbas Brigade

"When they [Iranian advisers] were there in the field, no one stands in our face and magically everything was available, the ammunition, the [intelligence] information, the smooth coordination with the military units and other [Shia] factions and the air force backup," Abu Sajad al-Saadi, a commander of the Abu al-Fadhil al-Abbas Brigade who participated in the Jurf al-Sakhar Battle, told Al Jazeera.

"They were not fighting but organising our efforts," Saadi added. "Without them, every group [Shia militia] was working alone and none of them were responding to the Iraqi military commanders, but if they [the Iranian advisers] are there, all sides were responding without any problems or complaints."

Several Shia militia commanders who fought under the command of Sulaimani in Jurf al-Sakhar, Jalawla and Saadia told Al Jazeera that he and other Iranian advisers have achieved two main things: reining in the Shia militias that were insisting on operating separately, and providing crucial logistical and technical support to Iraqi forces.

"Usually, there were many groups [Shia militias] in the field and instead of working together, they were competing against each other, and this deprived all of us from achieving any victory in the first few weeks," a senior Badr Organisation commander told Al Jazeera on condition of anonymity.

"Iranians have created a role for each group in the battlefield in a way that guided all of them [the Shia groups] to work side by side in parallel lines to achieve one goal without any fractions," he said.

The core of the logistical and technical role that Iranians have played has been providing intelligence information and air imagery from Iranian drones, according to Shia militia commanders and military officers.

Iran's Deputy Foreign Minister Ebrahim Rahimpour said his country carried out anti-ISIL air strikes in the border province of Diyala in late November at the request of Iraqi authorities, according to a report on Saturday in The Guardian.

"In Diyala, the most important thing was the drones. The drones had provided great information for our troops, especially in the first few days, that helped us to develop the [military] plans and fill the gaps," Essam al-Saadi, a commander of Abu al-Fadhil al-Abbas Brigade who participated in the Diyala battles, told Al Jazeera.

Since June, Iran has been formally providing the Iraqi government and Kurdish fighters with weapons and ammunition.

But Shia militia commanders told Al Jazeera that the Iranians had been delivering snipers and training courses - in particular for the Badr Organisation, Asaib Ahl al-Haq and Kataib Huzballa, the three militias established, equipped and funded by Iran - for years.

RELATED: Iran 'confirms strikes against ISIL'

"Iranians are not directly communicating with the Shia factions except the factions that already are connected to them, like Badr, Asaib and Kataib," a senior Shia militia commander told Al Jazeera on condition of anonymity.

"Many [Shia] factions are looking to communicate with them, but they have refused."

Political analysts and academics say the level of Iran's involvement in the battle against ISIL is nothing out of the ordinary, because Iran considers Iraq's security to be interlinked with its own national security.

"Iraq for Iranians is their first repelling line against ISIL ... so they believe that the loss of the Iraqi army and the Shia-led government in Baghdad means ISIL and its backers might be on its western border," Abdulwahid Tuama, an independent political analyst, told Al Jazeera.

"Also, the failure of the Shia-led government in Iraq, for any reason, would mean Iran losing its strategic ally in the region."