In the last few years, there has been a dramatic rise of a seemingly new type of polity: the Islamic rebel state. Boko Haram in West Africa, the Shabab in East Africa, the Islamic Emirate in the Caucasus and, of course, the Islamic State in the Middle East, known as ISIS, or ISIL — these movements not only call for holy war against the West, but also use their resources to build theocracies.

Though in some respects unprecedented, these groups also have much in common with the Islamic revivalist movements of the 18th century, such as the Wahhabis on the Arabian Peninsula and the great jihadist states of the 19th century. They waged jihad against non-Muslim powers, and at the same time sought to radically transform their own societies.

One of the first groups to engage in anticolonial jihad and state-building was the fighters led by Abd al-Qadir, who challenged the French imperial invasion of North Africa in the 1830s and 1840s. Qadir declared himself “commander of the faithful” — the title of a caliph — and founded an Islamic state in western Algeria, with a capital in Mascara, a regular army and an administration that enforced Shariah law and provided some public services. The state was never stable, nor did it ever encompass a clearly defined territory; it was eventually destroyed by the French.

Equally short lived was the Mahdist state in Sudan, lasting from the early 1880s to the late 1890s. Led by the self-proclaimed Mahdi (“redeemer”) Muhammad Ahmad, the movement called for jihad against their Egyptian-Ottoman rulers and their British overlords, and it established state structures, including a telegraph network, weapon factories and a propaganda apparatus. The rebels banned smoking, alcohol and dancing and persecuted religious minorities.

But the state was unable to provide stable institutions, and the economy collapsed; half of the population died from famine, disease and violence before the British Army, supported by Egyptians, crushed the regime in a bloody campaign, events chronicled in “The River War” by the young Winston Churchill, who served as an officer in Sudan.

The most sophisticated 19th-century Islamic rebel state was the Caucasian imamate. Its imams rallied the Muslims of Chechnya and Dagestan into a 30-year holy war against the Russian empire, which sought to subdue the region. During the struggle, the rebels forced the mountain communities into a militant imamate, executing internal opponents and imposing Shariah law, segregation of the sexes, bans on alcohol and tobacco, restriction on music, and the enforcement of strict dress codes — all hugely unpopular measures. Czarist troops confronted the imamate with extreme brutality, eventually shattering it.

In all of these cases, there were two distinct, though intertwined, conflicts, one against non-European empires and one against internal enemies, and both struggles were combined with state-building. This pattern is in fact not unique to the emergence of Islamic rebel states. The sociologist Charles Tilly once identified war as one of the most crucial forces in the formation of states: The foundation of a centralized government becomes necessary to organize and finance the armed forces.

At the same time, Islam was at the center of these movements. Their leaders were religious authorities, most of them assuming the title “commander of the faithful”; their states were theocratically organized. Islam helped unite fractured tribal societies and served as a source of absolute, divine authority to enhance social discipline and political order, and to legitimize war. They all preached militant Islamic revivalism, calling for the purification of their faith, while denouncing traditional Islamic society, with its more heterodox forms of Islam, as superstitious, corrupt and backward.

Today’s jihadist states share many of these features. They emerged at a time of crisis, and ruthlessly confront internal and external enemies. They oppress women. Despite the groups’ ferocity, they have all succeeded in using Islam to build broad coalitions with local tribes and communities. They provide social services and run strict Shariah courts; they use advanced propaganda methods.

If anything, they differ from the 19th-century states in that they are more radical and sophisticated. The Islamic State is perhaps the most elaborate and militant jihad polity in modern history. It uses modern state structures, including a hierarchically organized bureaucracy, a judicial system, madrasas, a vast propaganda apparatus and a financial network that allows it to sell oil on the black market. It uses violence — mass executions, kidnapping and looting, following a rationale of suppression and wealth accumulation — to an extent unknown in previous Islamic polities. And unlike its antecedents, its leaders have global aspirations, fantasizing about overrunning St. Peter’s in Rome.

And yet those differences are a matter of degree, rather than kind. Islamic rebel states are overall strikingly similar. They should be seen as one phenomenon; and this phenomenon has a history.

Created under wartime conditions, and operating in a constant atmosphere of internal and external pressure, these states have been unstable and never fully functional. Forming a state makes Islamists vulnerable: While jihadist networks or guerrilla groups are difficult to fight, a state, which can be invaded, is far easier to confront. And once there is a theocratic state, it often becomes clear that its rulers are incapable of providing sufficient social and political solutions, gradually alienating its subjects.

In this light, the international community should continue to check the expansion of groups like the Islamic State, and intervene to prevent widespread human rights abuses. But given that the United States and its allies are unlikely to commit the massive military resources necessary to defeat the Islamic State — let alone other jihadist states — the best policy might be one of containment, support of local opponents and then management of the groups’ possible collapse.

We need to recognize what these groups really are. Referring to them as a “cancer,” as President Obama has, is understandable from an emotional standpoint, but simplifies and obscures the phenomenon. Jihadist states are complex polities and must be understood in the context of Islamic history.