By Myra MacDonald
LONDON (Reuters) - The assault on Kenya's Westgate shopping mall has brought into sharp relief a pattern likely to complicate efforts to counter Islamist militants - competition among jihadis can increase the risk of a major attack.
As with the 2008 assault on the Indian city of Mumbai and this year's raid on an Algerian desert gas plant, the attack in Nairobi by Somalia's al Shabaab was preceded by in-fighting or loss of supporters to other militant groups.
This competition can initially make groups seem divided and weak, while actually making them more dangerous if a leader then feels compelled to mount a big attack to burnish his jihadi credentials - thereby bringing in fresh recruits and funding.
Western counter-terrorism officials have long been aware of the risk that intensive security measures adopted at home following the Sept 11, 2001 attacks on the United States are driving militants to target Westerners overseas.
But the impact of competition, sometimes caused by government efforts to curb militants, is only just beginning to be understood. It was thrown into sharp relief by the mall attack by al Shabaab, which killed 67 people.
Recognized by al Qaeda as an affiliate in 2012, the group had suffered from internal feuding as African Union forces, including troops from Kenya, drove them out of urban strongholds.
These rifts rose dramatically to the surface when the American-born Omar Hammami tweeted about what he said were attempts on his life by al Shabaab assassins sent by the group's leader. He was reported to have been killed this month in Somalia.
While it is too early to assess all the motivations behind the attack on the Westgate mall, the attention it received could help al Shabaab leader Ahmed Godane achieve his ambition of rebranding his group as a significant jihadist force, leading analysts to warn that more attacks could follow.
In the case of the Pakistan-based Lashkar-e-Taiba, blamed by the United States and India for the attack on Mumbai, outside pressure may have contributed to the internal dynamic that led it to mount a spectacular operation.
Unlike al Qaeda, its focus is on India and Kashmir. But like al Qaeda it is a Salafist group and shares its aim of a restoration of Muslim rule from Delhi to Spain - making it easier for followers to move between the groups.
Under severe pressure to rein in its activities after one of the men involved in the 2005 London transport bombings was linked to the group, Lashkar-e-Taiba began to lose members to al Qaeda and other groups fighting more actively in Afghanistan.
According to testimony by the Pakistani-American David Headley, who scouted out targets in Mumbai, the huge scale of the attack in India after initial plans for a more limited operation was encouraged by the need to compete.
The assault by 10 gunmen killed 166 people, gripped media attention during a three-day siege and became a template for subsequent "copycat" operations like Westgate.
The January attack at the Algerian gas plant, in which 39 foreign hostages were killed, also followed internal competition, this time more to do with personal rivalries.
Its Algerian mastermind, Mokhtar Belmokhtar, had set up his own group, although he retains strained but functioning relations with the Algerian-based leadership of Al Qaeda in the Islamic Maghreb (AQIM). Once dismissed as "Mr Marlboro" because of his smuggling activities, Belmokhtar staked a claim to be the true representative of al Qaeda in the region with the assault.
The role of competition makes it all the harder for governments to contain militants, whether through force - from drone strikes to ground operations - or by using infiltration and offers of talks to some factions to divide and rule.
In the 1990s, Algeria used infiltration to stir up in-fighting and break an insurgency which erupted after it suppressed elections that Islamists were poised to win. But this also encouraged more brutal attacks on civilians - an estimated 200,000 died in the civil war.
More recently, Pakistani efforts to divide and rule the Tehrik-e-Taliban Pakistan (TTP) by setting one faction against another may also be fuelling violence.
Little is known for sure about the internal dynamics of the TTP. But the group denied responsibility for a car bomb on Sunday which killed 42 in Peshawar - the third attack on the city in a week - raising the possibility that another faction may have been involved to demonstrate its power.
Meanwhile, for states seeking to combat militants, including al Qaeda, competition offers little comfort for it rarely runs deep enough to splinter and defeat jihadist groups altogether.
If anything, al Qaeda is proving more resilient than ever, despite the vast military force thrown against it since the September 11 attacks.
NETWORK OF ALLIANCES
Often thinking more globally than the governments which seek to counter it, its network of alliances stretching from its base in Pakistan to West Africa has left it well positioned to exploit the instability caused by the 2011 Arab uprisings.
Its leader Ayman al Zawahri appears to have settled into his role after the killing of Osama bin Laden in Pakistan in 2011, continuing to set overall direction for al Qaeda while ceding much operational control to affiliates.
Earlier this year, he intervened to stop in-fighting between two al-Qaeda aligned groups in Syria, Jabhat al-Nusra and the Islamic State in Iraq and the Levant - arguably proving more effective in preventing confrontation between allies than Western countries trying to shape the Syrian civil war.
The network is held together by personal and geographical links which ultimately override feuding and rivalries - connections which can often be traced back to Afghanistan and Pakistan and are now being forged anew in Syria.
Lashkar-e-Taiba, for example, has its roots in an organization created in the mid-1980s to support the jihad against the Soviet occupation of Afghanistan. Belmokhtar reached Afghanistan around 1989.
Godane went to Pakistan in the late 1990s on a scholarship, according to Stig Jarle Hansen, the Norwegian author of a book on al Shabaab. He disappeared for a time before returning home in 2001; but two of his peers from the same generation had been in the Khaldane training camp in Afghanistan.
That shared ideology makes it a virtual certainty that Islamist militants will strike again.
Exactly how capable different parts of the network are, and how much national and regional pressures limit their room for maneuver, often comes down to guesswork.
Following the raid on the Algerian gas plant, Belmokhtar's group claimed responsibility for attacks in May on a military base and a French-run uranium mine in Niger, West Africa - despite a French-led military operation designed to drive Islamist militants out of neighboring Mali.
Hansen suggested al Shabaab could attack other countries which, like Kenya, contribute forces to the African Union peace-keeping mission in Somalia. "There is more to come. They have the capacity; I think they will do it again. Ethiopia, Uganda and Burundi should watch their backs very carefully."
(Editing by Giles Elgood)