WASHINGTON -- As the uprising closed in around him, the Libyan dictator Col. Muammar el-Qaddafi warned that if he fell, chaos and holy war would overtake North Africa. "Bin Laden's people would come to impose ransoms by land and sea," he told reporters. "We will go back to the time of Redbeard, of pirates, of Ottomans imposing ransoms on boats."
In recent days, that unhinged prophecy has acquired a grim new currency. In Mali, French paratroopers arrived this month to battle an advancing force of jihadi fighters who already control an area twice the size of Germany. In Algeria, a one-eyed Islamist bandit organized the brazen takeover of an international gas facility, taking hostages that included more than 40 Americans and Europeans.
Coming just four months after an American ambassador was killed by jihadists in Libya, those assaults have contributed to a sense that North Africa -- long a dormant backwater for Al Qaeda -- is turning into another zone of dangerous instability, much like Syria, site of an increasingly bloody civil war. The mayhem in this vast desert region has many roots, but it is also a sobering reminder that the euphoric toppling of dictators in Libya, Tunisia and Egypt has come at a price.
"It's one of the darker sides of the Arab uprisings," said Robert Malley, the Middle East and North Africa director at the International Crisis Group. "Their peaceful nature may have damaged Al Qaeda and its allies ideologically, but logistically, in terms of the new porousness of borders, the expansion of ungoverned areas, the proliferation of weapons, the disorganization of police and security services in all these countries -- it's been a real boon to jihadists."
The crisis in Mali is not likely to end soon, with the militants ensconcing themselves among local people and digging fortifications. It could also test the fragile new governments of Libya and its neighbors, in a region where any Western military intervention arouses bitter colonial memories and provides a rallying cry for Islamists.
And it comes as world powers struggle with civil war in Syria, where another Arab autocrat is warning about the furies that could be unleashed if he falls.
Even as Obama administration officials vowed to hunt down the hostage-takers in Algeria, they faced the added challenge of a dauntingly complex jihadist landscape across North Africa that belies the easy label of "Al Qaeda," with multiple factions operating among overlapping ethnic groups, clans and criminal networks.
Efforts to identify and punish those responsible for the attack in Benghazi, Libya, where Ambassador J. Christopher Stevens was killed in September, have bogged down amid similar confusion. The independent review panel investigating the Benghazi attack faulted American spy agencies as failing to understand the region's "many militias, which are constantly dissolving, splitting apart and reforming."
Although there have been hints of cross-border alliances among the militants, such links appear to be fleeting. And their targets are often those of opportunity, as they appear to have been in Benghazi and at the gas facility in Algeria.
In the longer term, the Obama administration and many analysts are divided about what kind of threat the explosion of Islamist militancy across North Africa poses to the United States. Some have called for a more active American role, noting that the hostage-taking in Algeria demonstrates how hard it can be to avoid entanglement.
Others warn against too muscular a response. "It puts a transnational framework on top of what is fundamentally a set of local concerns, and we risk making ourselves more of an enemy than we would otherwise be," said Paul R. Pillar of Georgetown University, a former C.I.A. analyst.
In a sense, both the hostage crisis in Algeria and the battle raging in Mali are consequences of the fall of Colonel Qaddafi in 2011. Like other strongmen in the region, Colonel Qaddafi had mostly kept in check his country's various ethnic and tribal factions, either by brutally suppressing them or by co-opting them to fight for his government. He acted as a lid, keeping volatile elements repressed. Once that lid was removed, and the borders that had been enforced by powerful governments became more porous, there was greater freedom for various groups -- whether rebels, jihadists or criminals -- to join up and make common cause.
In Mali, for instance, there are the Tuaregs, a nomadic people ethnically distinct both from Arabs, who make up the nations to the north, and the Africans who inhabit southern Mali and control the national government. They fought for Colonel Qaddafi in Libya, then streamed back across the border after his fall, banding together with Islamist groups to form a far more formidable fighting force. They brought with them heavy weapons and a new determination to overthrow the Malian government, which they had battled off and on for decades in a largely secular struggle for greater autonomy.
Even the Algeria gas field attack -- which took place near the Libyan border, and may have involved Libyan fighters -- reflects the chaos that has prevailed in Libya for the past two years.
Yet Colonel Qaddafi's fall was only the tipping point, some analysts say, in a region where chaos has been on the rise for years, and men who fight under the banner of jihad have built up enormous reserves of cash through smuggling and other criminal activities. If the rhetoric of the Islamic militants now fighting across North Africa is about holy war, the reality is often closer to a battle among competing gangsters in a region where government authority has long been paper-thin.
Among those figures, two names stand out: Mokhtar Belmokhtar, the warlord who led the attack on the Algerian gas field, and Abdelhamid Abu Zeid, a leader of Al Qaeda's North African branch.
"The driving force behind jihadism in the Sahara region is the competition between Abu Zeid and Belmokhtar," said Jean-Pierre Filiu, a Middle East analyst at the Institut d'Études Politiques in Paris.
Mr. Belmokhtar has generated millions of dollars for the Qaeda group through the kidnapping of Westerners and the smuggling of tobacco, which earned him one of his nicknames, "Mr. Marlboro." But Mr. Belmokhtar bridles under authority, and last year his rival forced him out of the organization, Mr. Filiu said.
"Belmokhtar has now retaliated by organizing the Algeria gas field attack, and it is a kind of masterstroke -- he has proved his ability," Mr. Filiu said.
Both men are from Algeria, a breeding ground of Islamic extremism. Al Qaeda in the Islamic Maghreb, as the regional branch is known, originated with Algerian Islamists who fought against their government during the bloody civil conflict of the 1990s in that country.
Algeria's authoritarian government is now seen as a crucial intermediary by France and other Western countries in dealing with Islamist militants in North Africa. But the Algerians have shown reluctance to become too involved in a broad military campaign that could be very risky for them. International action against the Islamist takeover in northern Mali could push the militants back into southern Algeria, where they started. That would undo years of bloody struggle by Algeria's military forces, which largely succeeded in pushing the jihadists outside their borders.
The Algerians also have little patience with what they see as Western naïveté about the Arab spring, analysts say.
"Their attitude was, 'Please don't intervene in Libya or you will create another Iraq on our border,' " said Geoff D. Porter, an Algeria expert and founder of North Africa Risk Consulting, which advises investors in the region. "And then, 'Please don't intervene in Mali or you will create a mess on our other border.' But they were dismissed as nervous Nellies, and now Algeria says to the west: 'Goddamn it, we told you so.' "
Although French military forces are now fighting alongside the Malian Army, plans to retake the lawless zone of northern Mali have for the past year largely focused on training an African fighting force, and trying to peel off some of the more amenable elements among the insurgents with negotiations.
Some in Mali and the West had invested hopes in Iyad Ag Ghali, a Tuareg who leads Ansar Dine, or Defenders of the Faith, one of the main Islamist groups. Mr. Ghali, who is said to be opportunistic, was an ideological link between the hard-line Islamists of Al Qaeda in the Islamic Maghreb and the more secular nationalist Tuareg group, known as the National Movement for the Liberation of Azawad.
But so far negotiations have led nowhere, leaving the Malian authorities and their Western interlocutors with little to fall back on besides armed force.
David D. Kirkpatrick contributed reporting from Cairo, and Mark Mazzetti and Eric Schmitt from Washington.
This article originally appeared in The New York Times.