AT FIRST sight, it looks familiar. Veterans of the Afghan jihad operate training camps in Libya's lush Green Mountain, overlooking Europe's shipping lanes. Armed jihadis cruise the dusty streets with their armed acolytes. Preachers rouse their followers to take up weapons.

But something is out of kilter with Muammar Qaddafi's claims that Libya's revolution is an al-Qaeda plot. These jihadis enthusiastically back the NATO-led bombing campaign. “A blessing,” says Sufian bin Qumu, an inmate for six years of a pen in Guantánamo Bay, who drove trucks for Osama bin Laden's Sudanese haulage company before heading to the Afghan camps. “Excellent,” echoes Abdel Hakim al-Hisadi, a rebel commander who trained in Khost camp, Mr bin Laden's base in Afghanistan. “It's changed the way we look at the West. They saved our people and we have to say thanks.”

Not since Western governments first armed the anti-Soviet mujahideen in the 1980s have Western and jihadi groups seemed so aligned. To a man, they proclaim their differences from al-Qaeda, insisting that from the first they have waged a local struggle against a tyrannical ruler, not a global struggle targeting the West. In the mid-1990s they formed the Libyan Islamic Fighting Group, which for five years waged a guerrilla war in the hills above Darna, a coastal town north-east of Benghazi. Though many fled to Afghanistan after Colonel Qaddafi's counter-insurgency, most kept their distance from al-Qaeda. “I met Sheikh Osama,” says Mr Hisadi, “but refused to shake his hand.”

Darna's Islamist fighters are now an integral part of the wave of protest and revolt that has spread across the Arab world. Movements that began by drawing strength and gaining adherents from secular demands—for personal dignity and political freedom—have, with time, adopted a more religious and sectarian hue. Just as the protests have empowered a long-quiescent Arab middle class, so they have released the potential of Islamism, a multi-faceted, broad-spectrum current that runs deep throughout the region, but has for decades been repressed and manipulated by most Arab regimes. And some of its manifestations, as in Darna, are surprising.

The freeing by post-revolutionary Egypt and Tunisia of thousands of Islamist political prisoners has closed a dark chapter for human rights in those countries. Outfits like Libya's Islamic Fighting Group and Egypt's Jamaat Islamiya, both of which pursued terror campaigns in the 1990s and were on the radical fringe, express a newfound keenness for peaceful politics, explaining that their past resort to violence was only a response to repression. The Libyan Islamic Fighting Group has changed its name to the Libyan Islamic Movement, and its 12-member politburo has pledged allegiance to the National Council in Benghazi.

Milder Islamists, including Egypt's powerful Muslim Brotherhood and like-minded associates elsewhere, find today's greater freedom exhilarating, but also challenging. Shorn of the comfort of posing as noble opponents of hated regimes, they must dirty their hands with politics, propose concrete policies and accept diversity within their own ranks. Younger members, fresh from the novel experience of working with liberal secularists and even communists to achieve shared goals, increasingly question the aloof dogmatism of ageing leaders. This emerging Islamist mainstream looks for its model not to theocracies such as Iran's, but to the democratically elected AK party in Turkey, with its Islamic flavour diluted by tolerance for others and respect for secular institutions.

Use the interactive "Graphics Carousel" to browse our coverage of unrest in the Middle East

But there are also more disturbing manifestations of the Islamists' rise. Ask Anwar Mitri, a 45-year-old school administrator in the Upper Egyptian province of Qena. On March 20th self-appointed Muslim vigilantes in his village arrested him, “tried” him and lopped off his right ear. They said this was his punishment for renting a flat to a woman who they claimed was a prostitute, and for allegedly having sex with her. Mr Mitri says his attackers told him that “Nazarenes” like himself, a member of Egypt's 8-10% minority of Coptic Christians, were no longer protected by State Security Investigations, a feared secret-police branch that has been largely neutralised since the overthrow of President Hosni Mubarak's regime.

Similar attacks in other parts of rural Egypt have targeted liquor stores, alleged brothels and, in one fatal case, a Muslim farmer accused of apostasy. The perpetrators are widely assumed to be Salafists, adherents of a fundamentalist group influenced by Saudi Arabia that has made strong inroads, particularly among Egypt's poorest classes. Some assert that such incidents, as well as pre-revolutionary terror attacks targeting Egyptian Copts, may instead be the work of rogue secret policemen, whose aim is to stir sectarian divisions. Whatever the cause, Egyptian Christians have grown increasingly fearful. A recent rumour that Salafists planned to throw acid at unveiled women was enough to prompt the evacuation of Christian students from a university dormitory in the Upper Egyptian city of Asyut.

Like the Muslim Brotherhood, Egypt's Salafists represent a diversity of opinion. Most condemn such excesses and have, in the past, generally professed an aversion to politics. Shortly before Egypt's revolution, one Salafist preacher went so far as to pass a death fatwa on Mohamed ElBaradei, the Nobel prize-winning former UN nuclear chief who has become a leading figure of Egypt's secular opposition, for the sin of disobedience to the country's “rightful leader”, Mr Mubarak.

But as Egypt's protest movement gained enough momentum to overthrow the Mubarak government, Salafists, many of whom had experienced imprisonment or torture under his regime, eagerly joined in. In mid-March, when Egyptians voted in a referendum on whether to accept revisions to their constitution, Salafists were credited with boosting support for the winning yes vote by fanning fears that Christians and secularists planned to scrap an article that describes Islamic sharia as “the principal source of legislation”. To vote no, they whispered in an effective campaign using Friday sermons and leaflets, would be a vote against Islam.

Such sectarian undertones have been exploited by religious radicals, as well as governments, in Bahrain, Syria and Saudi Arabia. The Sunni ruling family of Bahrain has for years quietly fuelled Sunni fears that the island kingdom's 70% Shia minority is being manipulated by agents from the Shia “superpower”, Iran. The pro-democracy protests that erupted in January, and have since been crushed, began with a secular agenda for reform, but under the pressure of a violent crackdown inevitably took on a more sectarian cast.

Similarly, demonstrations in the Syrian city of Deraa erupted in mid-March to protest against the jailing of minors for spraying graffiti. As a cycle of violent repression and counter-demonstrations took hold, with dozens shot dead by police gunfire, anger spread, particularly among Sunni Muslims. They make up two-thirds of Syria's population, but have historically chafed at the dominance, during 40 years of rule by the Assad family, of the Alawites, an offshoot of Shia Islam whose adherents account for some 6% of Syrians.

The broader opposition, which suffers a legacy of harsh state repression and internal factionalism, has struggled to contain sectarian impulses. But the regime of Bashar Assad has been quick to exploit public nervousness over religious differences to secure acquiescence in his continued rule. Having witnessed at close hand the bloodshed in neighbouring Iraq and Lebanon, even many of Mr Assad's detractors still appear willing to settle for limited freedoms in exchange for social peace.

A headache for the West

It is not just in countries prone to sectarianism that Islamist extremists appear emboldened. The latest issue of Inspire, an online jihadist magazine that declares itself the English-language mouthpiece of al-Qaeda in the Arabian Peninsula (AQAP), the Yemen-based franchise of Osama bin Laden's global jihadist group, hails the Arabs' revolutionary fervour as a golden opportunity. “The revolutions that are shaking the thrones of dictators are good for the Muslims, good for the mujahideen and bad for the imperialists of the West and their henchmen in the Muslim world,” declared its lead editorial on March 29th.

Such enthusiasm has yet to be reflected in any detectable rise in the influence of armed jihadist groups. Nevertheless the escalating lawlessness in Yemen, where opposition to the rule of President Ali Abdullah Saleh unites a ponderously broad alliance, has sharply reduced security pressure on AQAP. (Its bold raid on a munitions factory in the southern Yemeni province of Abyan prompted a subsequent explosion that killed as many as 150 people on March 28th.) But it worries the Western powers intervening in Libya. Eastern Libya, the anti-Qaddafi rebels' stronghold, has long been a hotbed of Islamist activism. Darna, in particular, is said to have contributed a bigger proportion of jihadist fighters in Iraq than any other Arab city.

The Koran or Karl Popper?

Admiral James Stavridis, NATO's supreme allied commander for Europe, recently told American senators that “flickers” of intelligence suggested the presence of al-Qaeda and Hizbullah, the Lebanese Shia guerrilla group, among Libya's opposition. But he also said that its leadership appeared to be “responsible men and women”. Observers are not impressed by the opposition's competence, but agree that radical elements appear to be a small minority. Their anger is for the time being directed solely towards Colonel Qaddafi and his regime, and their stated aim is to create a modern, pluralist, democratic state.

The fears, expressed loudly in Israeli opinion columns and echoed by conservatives further west, that Arab democratisation could prove a Trojan Horse for radical Islam, often fail to account for another factor. Although the fate of Palestine still unites Islamists of all stripes, they appear divided on nearly everything else.

Some, for instance, continue to decry Western intervention in Libya as an imperialist crusade, despite the fact that it followed invitations from both the Arab League and the Organisation of the Islamic Conference, the world's main pan-Islamic body. While the extremists of al-Qaeda cheer the democratic wave as an opportunity, Saudi Arabia's arch-conservative, state-backed clergy have condemned it as tantamount to heresy. Iran's state-censored media has fumed about the sad fate of Bahrain's democracy movement, and celebrated the overthrow of “tyrants” in Egypt and Tunisia. But they have kept eerily mute regarding the bloody stifling of dissent in Syria, Iran's sole Arab ally.

Yusuf al-Qaradawi, the Egyptian-born star preacher on the Al Jazeera satellite channel, has proved a powerful cheerleader for protest movements everywhere. Not content simply to approve Western intervention in Libya, he passed a fatwa promising heavenly reward to any Muslim who kills Colonel Qaddafi. But as a Sunni Muslim close to the Muslim Brotherhood, he has condemned Bahrain's democracy activists as Shia bigots and tools of Iran.

The Muslim Brotherhood itself appears to be splitting, though not along dramatic ideological lines. The group, founded in Egypt in 1928, has been an important incubator of Islamist movements, and has survived decades of repression. Its highly disciplined youth movement proved crucial to the protests that overthrew Mr Mubarak. Now many of its more articulate members appear likely to gravitate towards a new political party, founded by a disgruntled former member of the Brotherhood's guidance bureau, rather than one backed by the bureau's leaders.

Meanwhile, in Libya's revolution, radicalism is showing a reasonable face. In a Friday sermon outside Benghazi's courthouse, the uprising's base, the preacher calls for a democratic civil state. “The discourse that I'm hearing is democratic,” says Zahi Mogherbi, a Benghazi political-science professor who blames radicalisation on the colonel's repression.

In Darna, councillors struggle to explain why the town has sent so many jihadists to foreign wars. “Before Muammar [Qaddafi], we had no Islamic movement and no Islamist problems,” explains a local judge. “He wanted to delegitimise his opposition.” The city prided itself on its reputation as an intellectual hub, before the colonel smothered Libya's chattering classes.

In the mountains above town Mr Hisadi, the rebel commander, is offering cursory drills to fresh recruits. He insists that he and his acolytes will lay down their arms once Colonel Qaddafi is toppled. He hopes for warm ties with the West, and aspires to recover his pulpit in the mosque from which the colonel expelled him. Mr bin Qumu, Mr bin Laden's truck driver, wants to write his autobiography, and to open a school teaching ethics.