BEIRUT — In early July, hundreds of mourners gathered for the funeral of Kamal Shirkhani in Lavasan, a small town northeast of the Iranian capital Tehran. The crowd carried the coffin past posters which showed Shirkhani in the green uniform of the elite Islamic Revolutionary Guard Corps and identified him as a colonel. Shirkhani did not die in a battle inside Iran. He was killed nearly a hundred miles away from the Iranian border in a mortar attack by the militants of the Islamic State "while carrying out his mission to defend" a revered shrine in the city of Samarra, according to a report on Basij Press, a news site affiliated with the Basij militia which is overseen by the Revolutionary Guards. Shirkhani's death deep inside Iraq shows that Iran has committed boots on the ground to defend Iraqi territory. At least two other members of the Guards have also been killed in Iraq since mid-June, a clear sign that Shiite power Iran has ramped up its military presence in Iraq to counter the threat of Sunni fighters from the Islamic State, an Al-Qaeda offshoot that seized much of northern Iraq since June. Iraqi security forces largely dissolved in the path of the Islamic State's advance on Baghdad, proving that the Shiite-led government could hardly defend itself. In late June, a spokesman for the militant group, formerly known as the Islamic State in Iraq and the Levant, announced that it was shortening its name to the Islamic State and would rule its territory as a Sunni Muslim caliphate overseen by its leader Abu Bakr Al-Baghdadi. The Islamic State considers Shiites to be heretics, and made a point of filming its fighters gunning down Shi'ite prisoners as it advanced. Iranian and Iraqi Shiites see it as an existential threat. Iran, with deep ties both to the Iraqi government and to a number of Iraqi Shiite militias, stepped in to stop it. Senior Iranian officials have denied that any Revolutionary Guard fighters or commanders are inside Iraq. But there's no doubt that prominent politicians and clerics in Iran have been rattled by the rapid gains of the Islamic State and the threat it poses, not only to the Iraqi government but to Iran itself. Iranian president Hassan Rohani pledged his government's support to help counter the threat posed by the Islamic State if the Iraqi government requested it. In late June, a senior Iranian cleric, Ayatollah Nasser Makarem Shirazi, said in a statement that waging jihad to defend all of Iraq, particularly holy shrines that are visited each year by millions of Shiite pilgrims, is "obligatory," according to a report from the semi-official Fars News agency. Samarra, a city on the Tigris north of Baghdad where Colonel Shirkhani was killed, is site of the first of those major Shiite shrines to land in the path of the Sunni fighters' advance. Iraqi government forces and Shi'ite militia swiftly mobilized and have so far succeeded in defending it. The deaths of Shirkhani and two others is proof that Iranians were part of that successful response. "When the Islamic State reached Shiite areas in Iraq, the Revolutionary Guards had forces there who fought them," said Mohsen Sazegara, a founding member of the Revolutionary Guards who is now a US-based dissident. "A number of them were killed." Qassem Soleimani, the head of the external operations branch of the Guards known as the Quds Force, recently traveled to Baghdad, according to reports from a number of Iranian news sites. An Iraqi parliamentarian posted a picture on the Internet of himself with Soleimani in Iraq in mid-June. Regional experts believe the Revolutionary Guards have increased the supply of weapons and funds to proxy militant groups inside Iraq in recent weeks. Critics of Iraq's Shiite Prime Minister Nouri Al-Maliki blame him for excluding Sunnis from government in Baghdad, inflaming sectarian tension and allowing hardliners like the Islamic State to cultivate support among Iraq's Sunni community. The Islamic State's rise was partly Iran's fault for doing too little to rein in the sectarian impulses of its ally Maliki, said Reza Marashi, a former Iran desk officer at the US State Department who is now the director of research for the National Iranian American Council. "Iran overplayed its hand. They overreached," he said. "By seeking to advance its interests with its Iraqi allies at the expense of other foreign and domestic players, look at what's happened: the Maliki government helped give rise to ISIS." Throughout the US occupation of Iraq, which ended in 2011, Washington accused Tehran of funding, arming and training Shi'ite militant proxy groups behind some of the deadliest attacks against US troops and revenge killings of Sunnis. Those militia groups have re-emerged in recent months to join the fight against Sunni fighters. A high-level Iraqi security official said Iran had now mobilized up to 20,000 Iraqi militiamen from groups it funded and trained. The fighters are spread south from Samarra to Baghdad and down into the farming communities south of the capital, he added. — Reuters