Over the last few years, one aspect of the Islamic State (ISIS) has loomed large in the public’s imagination: the group’s ability to attract foreign fighters. The attention makes sense; there is something particularly terrifying about the idea of merciless terrorists mobilizing from all corners of the world to decimate civilian populations in Iraq and Syria to help ISIS rapidly gain territory. Foreign fighters also preoccupied Western governments, which were faced with the prospect of battle-hardened jihadists returning home. But now, three years into ISIS’ war, its once mighty weapon is now threatening to cut off the hand that feeds it; foreign fighters are quickly becoming one of ISIS’ biggest liabilities.

It should have been obvious from the start that local and foreign fighters would have different goals. ISIS’ official position has been that all fighters are equal, but tensions among groups did not go unnoticed. Still, the group’s internal dynamics remained relatively stable because it was successful on the battlefield and in oil production. But now that ISIS is not as rich and powerful as it once was, it can no longer afford to buy everyone’s loyalty. Already, a major internal split is hurting the group’s combat performance. In Iraq alone, since last month, ISIS lost all three battles it fought along with control of two towns and more than 30 villages.

According to local ISIS fighters, foreign fighters are more trouble than they’re in fact worth. Foreign fighters’ inability or unwillingness to cooperate with local fighters has culminated in deadly races for money and power. In July 2015, for example, Albanian and Russian ISIS militants killed three local fighters and wounded several others in the Alace Oil fields south of Kirkuk, a transit-point for ISIS’ oil smuggling operations. Local ISIS militants reported that the groups fought over differences in proposed military strategies on the frontline near Alam and that local fighters refused to follow a foreign officer’s orders. But the civilian population of the area doesn’t buy this characterization. Most locals believe that the conflict was over oil money. “One group of Iraqi militants sold oil to the tanker drivers going to Syria through Mosul, and another group took bribes to let those oil tankers go, but foreign fighters tried to stop tankers for additional checking. They just fought over business interests,” said Muzher Abbas from the ISIS-held town of Abbasya, who used to work as an oil-tanker driver in the area.

An Iraqi security forces uses the binoculars as he keeps watch in the city of Ramadi, January 16, 2016. Thaier Al-Sudani / Reuters In another instance, when a dispute between foreign and local fighters actually reached the Islamic State’s courts, foreign fighters pressured judges to decree harsh sentences (like a death penalty) for local fighters they disagree with.

It’s also no secret that ISIS has long employed deep institutional discrimination in its military orders: a fighter’s relative position in the hierarchy was based on his nationality. Americans, Europeans, and Eastern Europeans (including Russians and Chechens) occupied middle-rank administrative positions in IED factories and training camps and on frontline military bases; “Chines” (Central Asian) ISIS militants were primarily used as suicide bombers. Native Arabs were divided into two groups—those in top-level leadership positions and those in the lowest possible positions.

This hierarchy lasted for nearly two years, but two recent battles have dramatically changed the pecking order. In battles at Sinjar and Bashir, foreign soldiers persuaded ISIS leadership that they were qualified to organize and command the fight. (They surely realized that doing so would help them gain military status and war spoils—including women, cars, houses, and food.) ISIS leadership agreed to let the foreign soldiers run the battles, but both were disasters.

On April 10, 2016, foreign fighters (Russian, Caucasus, Chines, and Chechens) who were supposed to lead the fight in Bashir fled four hours before Peshmerga forces and Hashd al-Shabi (Shia militias) had even entered the village. These foreign fighters left local fighters with no ammunition, no supplies, and no advanced weapons to face the ground offensive. The battle was a complete failure—dozens of ISIS militants were killed, and ISIS lost more than four strategic villages near the oil-rich city of Kirkuk.

The battle in Sinjar, led by French, Russian, and American ISIS fighters, was even worse. Several days before the battle began, one European ISIS militant stole $70,000 and disappeared, leaving the rest of the militia with little ammunition, food, or backup forces. The fighters didn’t last a day. One local ISIS militant who drove a pick-up truck during the battle said, “They [the foreign fighters] did not lose Sinjar; they sold Sinjar instead of defending it.”

Such cowardly combat behavior reinforces deep suspicions among local fighters and civilians, and the conspiracy theories abound. Local militants once believed that Western foreign fighters were true believers, highly professional, and educated to boot. Now local people see these foreign fighters as thugs; the only “rational” explanation is that the foreign fighters are really working for their own governments. One ex-Iraqi army officer explains, “There are many rumors in Hawija that foreign fighters’ flags contain a phosphoric material that sends signals to U.S.-led coalition warplanes. Therefore, the warplanes do not shell them and the bases they work in.”

A member of the Iraqi security forces walks past a wall painted with the black flag commonly used by Islamic State militants in Shirqat, Iraq, September 22, 2016. Reuters In the end, the battles of Bashir and Sinjar were a perfect excuse for local fighters to start taking back vital administrative and military positions in frontlines in Ninawa Province (including Mosul). But the foreign fighters have not been willing to give up those positions. In August, a dispute between groups of local and French ISIS fighters, both of which wanted to manage an administrative office in the Bab al-Tub area, led to a firefight in a crowded Mosul market.

ISIS leaders have stabilized the situation in Iraq by completely removing foreign fighters from administrative and political positions and relegating these fighters to IT-related intelligence work, IED factories, and technical tasks. In some areas, foreign fighters are even housed in rural villages to keep their interactions with locals to a minimum. In response, disenfranchised foreign fighters have resorted to small acts of sabotage. In September, a Saudi ISIS member dismantled a major tunnel that had connected the Al-Shirqat town center with the Shakra Area. It was an escape route for ISIS militants, but he destroyed it after passing through it himself, making the chasm between foreigners and locals even wider.

Competition between natives and migrants for power is nothing new in the Middle East. When the Prophet Mohammed died in 632 CE, Muslim warriors from Makka and the local people of Medina began struggling for leadership of the newly formed Islamic State. Eventually, the foreign fighters from Makka imposed their will and appointed Abubakr Sdiq as the successor.

Although such history might serve to inspire foreign fighters, it looks like this conflict will play out much differently. Most likely, foreign fighters will continue to lose power and, as they go down fighting, will take the Islamic State with them.