Earlier this year, as the Islamic State of Iraq and the Levant (ISIL) suffered major defeats by various rebel groups in Syria, it raised a defiant slogan: “Remaining and expanding”. A few months later, the slogan does not look as detached from reality as it used to. The group, arguably the most brutal in the region, is now in control of large swathes of lands stretching from Aleppo to Raqqa to Deir Ezzor, in Syria, and from Ramadi to Fallujah and Mosul, in Iraq.

The group’s remarkable successes defy basic military instincts. Consider the type of adversaries ISIL has fought since December. It fought the Iraqi army, backed by battle-hardened Shiite militias as well as Sunni tribal forces, in Anbar. In Syria, secular, Islamist and Al Qaeda-affiliated rebels fought ISIL in Aleppo, Idlib and Deir Ezzor, with little success except in Idlib. And yet, the group is still as strong as ever.

So the pressing question is: how can this numerically small group control large areas in two countries? Three main reasons can be identified for its resilience and expansion.

The first is the inconsistency of its opponents. In Iraq, the revival of the group since it was essentially wiped out in the wake of the country’s civil war in 2006 and 2007 was made possible in large part due the imprudent policies of prime minister Nouri Al Maliki. The biased anti-terror laws as well as the tendency to employ sectarian rhetoric in military campaigns against militancy in Sunni areas, as he did in his speech in December, have estranged the Sunni population, which has played into ISIL’s hands.

These policies lead Sunnis, even while they dislike ISIL, to feel they have no stake in fighting ISIL or resisting its presence because the government is just as bad. Additionally, there is a growing sense among Shiites that they have no stake in fighting in Sunni areas and leaving their areas exposed to danger. That leaves the Iraqi government forces with little appetite to face a brutal and resilient militia.

In Syria, ISIL’s opponents have not stood together, even on a factional level, in the fight against the group. Although ISIL has killed and humiliated the leaders of major rebel groups, many Islamists were reluctant to fight a fellow jihadi group rather than focus on the fight against the regime – regardless of ISIL’s day-to-day acts. This helped the group to establish a cult of fear across Syria, despite its relatively low numbers. The fear was broken as many groups declared war against ISIL, but the group has already become resilient and hard to defeat.

The second reason is, simply put, the clarity of its ideology and approach compared to other Islamists. In a business lingo, why would a potential buyer wait for a building planned for construction by a company that might and might not build it, when there is a building already under construction? The fact that ISIL has already announced an “Islamic state” that Muslims can join, and fight for its survival and expansion, appeals to a considerable number of people – even though its brutal tactics have alienated others.

ISIL is quietly expanding its following in the villages and towns dotting the Iraqi-Syrian border mostly because of the perceived reality of an Islamic state. In recent interviews with ISIL associates or their family members, it is clear that the group’s rigid yet clear ideology appeals to an increasing number of young people. These fighters currently travel to hotspots to fight with ISIL, and are not necessarily busy imposing its ideology in their hometowns.

The third reason is the group’s ability to gain substantial funding. As most jihadist groups, ISIL justifies extortion, ransom payments, takeover of weapons from fellow rebels and monopoly of resources by the fact that it considers itself as the only legitimate Islamic entity that represents the interests of Sunni Muslims. It acts as a state and other fighters can either pledge allegiance to it or be considered legitimate targets. While other rebel groups fight the regime, ISIL has busied itself with taking over areas under rebel control, seizing weapons from rebels under various pretexts. In eastern Syria, ISIL has taken control of oilfields, gas plants, factories and other lucrative resources.

Donors with deep pockets also prefer to sponsor an Islamic state in the making rather than a project for one. This tendency reflects an ongoing debate among Islamists from across the spectrum, mainly that attempts to establish an Islamic state by pragmatic groups through peaceful means have consistently failed thanks to an unreceptive regional and international political order. While such reality does not necessarily draw existing political Islamists towards the extreme, it encourages new recruits to join or support the more “realistic” forces to hit their enemies where it hurts.

As far as the recent events around Mosul are concerned, a caveat is in order. ISIL was not the only force that took part in the overrunning of Iraq’s security forces, even though it might be convenient for everyone to portray it as such. There are reports that other forces – including a Sufi-Baathist militia known as the Army of the Men of the Naqshbandi Order, which appeals to many Iraqi Sunnis as they offer a nationalist alternative to the brutish ISIL – have played a central role. In 2009, US officials warned that the Naqshbandis might be more dangerous than Al Qaeda because it had managed to build roots within society. The group was mostly based in Mosul and Kirkuk, the sites of this week’s advances.

Where does Iraq go from here? Given the recent performance of the Iraqi army, Baghdad is unlikely to be able to regain ground from these militias. The situation in northern Iraq resembles that of northern Mali in the early months of 2012, when insurgent groups overran government forces and took control of the region. The way to counter the influence of ISIL might be just what happened in Mali, a foreign military to pave the way for a peace deal. But a lasting solution could not be clearer: alongside a military campaign, Baghdad must be pressured into carrying out substantial and real reforms to include Sunnis in the political process.

Hassan Hassan is a Middle East analyst based in Abu Dhabi

On Twitter: @hhassan140