I n the summer of 2014, with a campaign of shocking violence, the Islamic State established itself as the most fearsome terrorist organization in the Middle East. In early June, the extremist group stunned the world by taking control of the Iraqi city of Mosul, home to more than 1.2 million people. Days later, ISIS fighters broadcast scenes from a gruesome massacre of more than 1,500 Iraqi army cadets at a former U.S. military base near Tikrit. By the end of the month, ISIS leader Abu Bakr al-Baghdadi had declared himself head of a new proto-state, the “caliphate,” as his fighters continued their genocidal rampage across northern Iraq, killing and enslaving members of the Yazidi minority and seizing Western hostages, among them an American journalist named James Foley. As the international community groped for a response, ISIS fighters reached the borders of Iraqi Kurdistan, within striking distance of the glass high-rises of the bustling Kurdish capital, Erbil. It was there, from a dusty, remote Kurdish military base nicknamed “Black Tiger” outside the town of Makhmour, that ISIS was finally confronted by Kurdish Peshmerga in a battle that began to turn the tide against the extremists. “Makhmour was the first place that we took territory from ISIS,” Staff Col. Srud Salih, the Kurdish commander of the Black Tiger base, told The Intercept this summer. “The victories of the Peshmerga began from here.” The battle of Makhmour represented another important milestone in the war against ISIS: It was the place where two foreign military interventions began. One was directed by the U.S.-led international coalition, which provided air support and later, heavy weaponry. The other, in the form of ammunition, training, and intelligence support, came from Iran. Over the course of a few short days that August, coalition airstrikes hit ISIS positions in the parched desert hills near Makhmour, leveling the playing field between the heavily armed extremists and the Kurdish fighters.

A Kurdish Peshmerga soldier walks past the remnants of an Islamic State position in Makhmour, Iraq, that was hit during the fight between Kurdish and ISIS forces in 2014. Photo: Sebastian Meyer/Corbis via Getty Images

Since the election of Donald Trump, the United States and Iran have grown increasingly fractious, exchanging provocations that have fueled fears of war. But in the early days of the fight against ISIS under President Barack Obama, these longtime rivals were focused on a common goal: halting the Islamic State’s advance and destroying its so-called caliphate. While the broad outlines of the conventional war against ISIS have long been known, the details of Iran’s covert war against the militants have not. A portrait of this secret war emerges from a trove of Iranian intelligence reports provided to The Intercept by an anonymous source. The reports come from Iran’s Ministry of Intelligence and Security, or MOIS, the country’s primary intelligence agency. A Secret Battle Alongside the U.S.-led military campaign against the Islamic State, Iran’s MOIS was waging a parallel, clandestine campaign, spying on ISIS gatherings, providing covert aid to its enemies, and working to break its alliances with other insurgent factions, according to the leaked documents. In many ways, the Iranian intelligence campaign against ISIS mirrored the U.S. strategy for dealing with Iraq. In addition to an overt military confrontation with the group and support for Shia militias and the Iraqi Army, the Iranians also worked to cultivate Sunni and Kurdish partners whom they perceived as moderate — or at least willing to work with them. From the outset, the MOIS kept its eyes on the day the war would end, when local partners from all sides would be needed to patch together a functional Iraq. To an extent, the agency played a good-cop role in contrast to the more brutal measures employed by the Islamic Revolutionary Guard Corps, which reports directly to Iran’s supreme leader. While the MOIS has been pragmatic, subtle, and willing to look past sectarianism, the Revolutionary Guards, through its Iraqi proxies, has been blamed for carrying out waves of extrajudicial killings and ethnic cleansing. In some cases, it has been accused of treating entire Sunni communities as enemies, trapping them in an impossible choice between religious extremists and a hostile Iraqi government.

In many ways, the Iranian intelligence campaign against ISIS mirrored the U.S. strategy for dealing with Iraq.

This sectarian conflict came to a head during the brutal violence of the ISIS war. But for those Sunnis — whether militants or politicians — willing to accept a place in an Iranian-dominated Iraq, the MOIS showed itself ready to help. According to the leaked Iranian intelligence documents, there was also frustration on the Iranian side about the lack of direct U.S. cooperation with Tehran in the anti-ISIS war effort. The Iranians noted with approval the impact of U.S. airstrikes against ISIS but wanted to coordinate more closely. “The Americans’ insistence on not cooperating with Iran in the war against ISIS and not participating in the meetings of the 10 countries of the region — the Arabs and Turkey — as well as the Western and Arab countries’ extreme positions on the presence and role of Iran in Iraq has had a negative influence,” one secret report noted. Although the Iranian contribution was ultimately more modest than that of the Americans, Iran was nimbler in backing the Iraqi Kurds. “Iran’s security institutions are often able to make decisions and act more quickly in an emergency than their U.S. counterparts, who have to navigate a web of bureaucracy,” a Kurdish analyst who was present during the battle, and asked for anonymity to discuss issues related to Iran, told The Intercept. “When ISIS attacked Makhmour, the Iranian help came first. It took a day or two after the battle began for the Americans to join in with air support.” The punishing American airstrikes made a vital difference in Makhmour, where the Kurdish Peshmerga ultimately triumphed over ISIS and drove it out of the area. But in the weeks and months before the battle, some of the Peshmerga who fought in Makhmour had received assistance from Iranian advisers connected with the MOIS.

Members of the People’s Protection Units, or YPG, explore one of the many tunnels made by ISIS during its occupation of the border city of Sinjar, Iraq, in 2015. Photo: Paolo Pellegrin/Magnum Photo

Spying on ISIS In its propaganda videos and statements, ISIS liked to project an image of complete ideological discipline and authoritarian control. But from early on, the organization appears to have been penetrated by both Iranian and Kurdish intelligence. On the evening of September 18, 2014, a case officer from the MOIS left his base and headed to the home of an asset living in Erbil. At the time, ISIS was still near the height of its power, and the city was teeming with foreign military and intelligence officials helping coordinate the war effort against the militants. The MOIS officer took precautions to avoid surveillance as he made his way to the meeting. “I left the base by foot an hour before holding the meeting and after twenty minutes walking on foot and carrying out the necessary checks, took two taxis through the neighboring streets to the site of the meeting,” he wrote in his report. The Iranian spy had two goals that night: to learn as much as possible about how Iraq’s Sunni leaders viewed the ISIS threat and to create a “detailed and precise biography of Abu Bakr al-Baghdadi through his classmates and people who had been imprisoned with him.” The meeting was one of many being conducted by MOIS officers trying to develop an operational picture of ISIS. In a December 2014 rendezvous with a source in the Kurdish city of Sulaimaniyah, another MOIS officer received a flash drive containing information about ISIS, according to one of the reports. The officer instructed the source, who is only identified as a senior deputy official in Iraqi intelligence, to send the Iranians daily reports on ISIS activities.

A screenshot, taken on July 5, 2014, of a propaganda video released by al-Furqan Media allegedly shows Abu Bakr al-Baghdadi addressing worshippers at a mosque in the militant-held Iraqi city of Mosul. U.S. forces killed Baghdadi last month in northern Syria. Image: AFP via Getty Images

The MOIS’s intelligence sources about ISIS were not limited to outsiders; they had penetrated the group’s leadership as well. A report provided to the MOIS by a source in Mosul contains an account of internal deliberations from a December 2014 meeting of senior ISIS leaders, including Baghdadi. At the time, ISIS was bracing for an attack from the Iraqi Army, Shia militia groups, and the Kurdish Peshmerga on the group’s territories in Nineveh Province. The attack was planned for the early months of 2015, and ISIS leaders feared that it would be heavily backed by both the U.S.-led coalition and Iran. The prospect of facing so many adversaries at once bred justified paranoia inside the militant group. It also raised fears that ISIS leaders with past ties to the Iraqi government of Saddam Hussain might feed intelligence to the group’s enemies, or even defect. “Some ISIS amirs who have a Baathist record have established relations with the Kurdish Democratic Party to flee to the Kurdish region and not fall into the hands of the Shia Iraqi army,” the MOIS source said, according to the intelligence report, which cites a meeting of the “Central Council of the Caliphate presided over by Abu Bakr al-Baghdadi.” In at least one case, the militant group’s fears had already come to fruition. ISIS commanders in two districts north of Mosul had made contact with American and Kurdish forces, given them GPS coordinates of ISIS positions, and revealed the group’s attack plans, according to the MOIS report. In response, ISIS had cut “all telephone and internet connections” for commanders in those areas, and the group wanted to further limit the communications of other front-line commanders. One of the districts named in the MOIS document, Zumar, was the site of heavy coalition air activity in support of a Peshmerga offensive during this period. “A sharia court determined that greater control should be exercised over contacts between ISIS amirs and that all means of communication, especially at the fronts, should be cut,” the MOIS source reported.

Sunni fighters opposing the Islamic State take positions at the frontline near the ISIS-controlled village of Haj Ali in the southern Mosul countryside on Nov. 19, 2015. Photo: Moises Saman/Magnum Photos

Divide and Conquer As Iran worked to weaken the Islamic State, it embarked on a strategy that, deliberately or not, echoed the U.S. playbook for dealing with Iraq. Nearly a decade earlier, the United States had defeated Al Qaeda in Iraq — the precursor to ISIS — by arming Sunni tribal groups opposed to the extremists. This tribal rebellion, termed “the Awakening,” was credited with helping fracture Al Qaeda’s ties to other Sunni Arab militants. The Awakening helped stabilize the country during the final years of the U.S. occupation, allowing a tenuous new political order to take shape. Like Al Qaeda before it, the Islamic State belonged to a broad coalition of Sunni Arab factions that were ideologically diverse but united in their opposition to an Iraqi government they viewed as sectarian, corrupt, and beholden to Iran. Many of the most powerful non-ISIS factions could be described as ideologically neo-Baathist in their shared longing for a restoration of the pre-2003 order in Iraq. The groups initially cooperated, but by the summer of 2014, deadly firefights were reported between ISIS and Sunni militants who did not accept the group’s leadership of the insurgency against Baghdad. Iran was ready to capitalize on these divisions. By the fall of 2014, the MOIS was surveilling and communicating with disaffected insurgents, with the goal of reconciling them with the Iraqi government and turning them against ISIS. But the Iranians found that the Sunni militants could be deceptive, the MOIS documents show. In September 2014, the agency intercepted a communication from some of these militants to their followers that included derogatory statements about Iran and called on fighters to take advantage of a recent halt in Iraqi government airstrikes to escalate their insurgency.

“We should try to weaken their position and show how untrustworthy they are in claiming that they have changed and become moderate and care for Iraq.”

“Since we are supposed to meet Baathists next week, and considering the principles fixed by the honorable General Director to get answers from them — naturally some of the answers are clear from the text of this statement,” a MOIS officer wrote dryly. “We should try to weaken their position and show how untrustworthy they are in claiming that they have changed and become moderate and care for Iraq. Put this statement in front of them and then ask them to be explicit and clear in their view.” Iranian officials closely monitored efforts by Sunni Arabs to organize themselves politically throughout the war, including at several meetings held at the Sheraton and Rotana hotels in Erbil in late 2014. An Iranian spy who attended a two-day meeting at the Sheraton in September reported that a former Baath Party member now living in the United States came to the meeting bearing an intriguing message: The Americans were willing to support political autonomy for Sunni-majority regions of Iraq once the fighting had ended. The MOIS was deeply concerned about Iraq breaking apart along sectarian lines and viewed any efforts that might lead to such fragmentation with suspicion. Three months later, in December, a delegation of Iraqi politicians including former parliament speaker Salim al-Jabouri traveled to Iran for negotiations with high-ranking Iranian officials. The trip went well, according to a MOIS report, but there was a tense moment when members of the Iraqi delegation were berated by Ali Shamkhani, secretary of Iran’s Supreme National Security Council. Shamkhani told the visitors that Sunnis in Iraq had already received “much more than you deserve,” including the leadership of numerous ministries, seats in the Iraqi parliament, and control of a large number of militia fighters. “Whether you want it or not,” he told them, Iran would “cleanse Iraq of the presence of [ISIS].” Some members of the Iraqi delegation were “offended” by Shamkhani’s remarks, according to the cable. Initial efforts by the highly unpopular Nouri al-Maliki-led Iraqi government to coax some Sunni tribes nominally allied with ISIS back onto its side with money and weapons had limited results. But a change of leadership in Iraq coupled with the brutality of life under ISIS did eventually lead some Sunni insurgents to explore switching sides. By 2015, the Iraqi government was said to be holding secret talks in Qatar and Tanzania with anti-ISIS Sunni insurgents, reportedly mediated by the United States and other countries in the Middle East.

Mohammed Haji Mahmoud, center, with his son Atta, far right, on the front near Kirkuk on Nov. 26, 2014. Atta was killed the following day. Photo: Archives Hama Haji Mahmoud/The PhotoLibrary of Kurdistan

“They Put Into Practice the Lessons They Had Learned” On the morning of December 7, 2014, a delegation of Iranian intelligence officers paid a condolence visit to the headquarters of the Kurdistan Socialist Democratic Party, a small movement based in the Kurdish city of Halabja. In addition to the Kurdish Regional Government, Iran cultivated ties with marginal parties like the KSDP that lacked strong connections and military support from Western powers — part of a broader strategy of projecting influence through textured personal and political relationships across the Middle East. Such ties, sometimes pragmatically cultivated on a nonsectarian basis, have given Iran an advantage in its conflicts with the United States, Israel, and the Gulf Arab countries. The head of the KSDP, Mohammed Haji Mahmoud, also known as “Kaka Hama,” is a legendary Kurdish nationalist who spent decades in the mountains of Kurdistan helping lead a resistance movement against the dictatorship of Saddam Hussein. When ISIS attacked Kurdistan in 2014, Mahmoud himself joined battles at the front. In late November of that year, Mahmoud’s son was killed fighting ISIS near Kirkuk. A week and a half later, spies from the MOIS showed up at Mahmoud’s office. “A delegation of colleagues of the consulate went to the political office of KSDP and recited [prayers] and offered our condolences and paid our respects to Mohammed Haji Mahmoud over his martyred son who achieved martyrdom in the suburbs of Kirkuk in an attack against ISIS,” according to a secret Iranian intelligence report. An Iranian official present expressed the ministry’s grief over the death of Mahmoud’s son and “wished his family patience and tranquility.”

Photo: Archives Hama Haji Mahmoud/The PhotoLibrary of Kurdistan

In January, about six weeks after their condolence visit, MOIS officers met with Mahmoud again. According to their report, the Kurdish leader thanked the Iranians for providing “special military and security training” to some 30 of his party’s Peshmerga fighters based in Sulaimaniyah. The training, according to the report, had been conducted in honor of Mahmoud’s son, and the Iranian-backed fighters had been sent to a front near Makhmour, where they helped rout ISIS. “They played a good role in defeating the takfiris,” Mahmoud told the Iranians, using an Arabic word to denote extremists, “and they put into practice the lessons they had learned.” The MOIS case officer who wrote the report expressed satisfaction with Mahmoud’s comments. “God willing, we will benefit from the existence of these brothers in future training in Iraq toward the struggle with ISIS.” Mahmoud could not be reached for comment for this story.

Iraqi Kurdish Peshmerga fighters fire at ISIS militant positions from the frontline in Khazer, west of Erbil, on Aug. 14, 2014. Photo: Safin Hamed/AFP via Getty Images

Friends in Fair Weather The Iranians would turn out to be less than durable friends to the Iraqi Kurds. Their dealings bear some resemblance to the United States’ own tortured relationship with Kurdish militants in neighboring Syria. Not long after the war against ISIS began, Tehran started shifting the bulk of its support to the Iraqi central government and its allied Shia militias. The major break came in 2017, when Iraqi Kurds held a referendum on the question of full independence, their long-held dream. Kurdish voters overwhelmingly approved the referendum, but the vote alarmed Iran and other countries in the region that feared Kurdish secession. Instead of independence, the referendum led to war between the Iraqi government and Kurdish forces. In a reversal of their role during the ISIS war, the Iranians worked against the Kurds, and the Iraqi offensive snuffed out any imminent hopes for Kurdish self-determination. In October 2017, the Peshmerga lost the town of Makhmour again — this time to an Iraqi government advance backed by Iran.

Gen. Bahram Arif Yassin was one of the Peshmerga commanders who led the fight against ISIS in northern Iraq. On a grassy hilltop in front of his home in the Kurdish city of Souran, surrounded by his military staff, he reflected on the bitter aftermath of the ISIS war and Kurdistan’s thwarted independence bid. “We expected support after the sacrifices we had made on behalf of the whole world fighting ISIS,” Yassin said. “Instead, we were opposed by surrounding countries that did not respect the Kurdish people’s voice.” “When the independence vote happened, even Turkey didn’t close its borders to us,” Yassin continued. “Iran did.” Although Makhmour remains under Iraqi control today, the sprawling Black Tiger base in the hills outside the town is still manned by Kurdish Peshmerga forces who are based in a few prefabricated bunkers. A giant Kurdish national flag flies from a pole above the base and a large hangar contains Humvees and other armored vehicles provided by the U.S.-led coalition. Modified vehicles taken from ISIS during the battle for Makhmour broil under the glaring sun. Among them are captured Iraqi army pickup trucks retrofitted with rusted armor plates and artillery pieces emblazoned with the black flag of the Islamic State.

Photo: Murtaza Hussain/The Intercept