A commander in Iran’s Revolutionary Guard Corps training Iraqi Shiite fighters to take on the Islamic State group was killed by a sniper over the weekend, Reuters reported Sunday. The commander was killed in the city of Samarra northwest of Baghdad, home to holy Shiite shrines, that in recent weeks has seen intense fighting between Shiite militias and the Sunni militant group formerly known as either ISIL or ISIS.

Brig. Gen. Hamid Taqavi, a veteran of the Iran-Iraq War between 1980 and 1988, was killed by a sniper hiding behind a power transformer during combat in Samarra, according to a Revolutionary Guard statement cited by Iranian official media. A funeral procession will be held in Tehran Monday.

Samarra has historically been a target for Sunni-led violence, especially during the Iraq War when Sunni militants bombed holy Shiite shrines. Taqavi and his forces were fighting in Samarra with Shiite forces led by the famous cleric Moqtada al-Sadr. Sadr leads a fighting group known as the Peace Brigades who work in coordination with the Iraqi security forces stationed in the city.

Iran has had influence in Iraq for years and is actively training, equipping and working with the country’s Shiite militias to fight the Islamic State group.

The U.S. has known of Iranian influence in Iraq for years. Under President George W. Bush, the U.S. government “revived charges that the Iranian leadership was involved in the killing of American soldiers in Iraq,” Seymour Hersh wrote in a 2008 article in the New Yorker. Retired Adm. William Fallon told Hersh that during his time at the U.S. Central Command, which is responsible for operations in the Middle East, “Iranians were funding every entity inside Iraq.”

Since ISIS began its march toward Baghdad in June, the militant group has taken over key, oil-rich towns and now controls a stretch of land from Aleppo in Syria all the way to the suburbs of Baghdad. The Shiite militias recruited by the Iraqi central government and backed by Shiite-majority Iran are basically the only forces preventing the Islamic State from reaching Baghdad.

The Iranian air force has also helped fight against ISIS. This month, the U.S. Defense Department said Iran attacked targets in the eastern part of the country. Both the U.S. and Iran have refuted claims the two countries were working together and coordinating attacks in Iraq, as reported by the Guardian.