Check into any big hotel in Somalia, and it’s not unusual to meet a government minister in the dining room, an ex-warlord in the lift, and a presidential candidate and his campaign team in the lobby.
This is not because of the quality of the hospitality. The average hotel in Mogadishu, for example, is no Burj Al Arab. But after nearly 30 years of war, car bombs and targeted assassinations, many VIPs feel safer in an anonymous, heavily guarded block than they do in their own home or office. Some live as guests for years.
Yet, as last weekend's carnage at the Medina Hotel in Kismayo proved, the sense of security is sometimes illusory. In a combined suicide bomb and gun attack that lasted 14 hours, Al Shabab militants stormed the hotel compound and killed 26 people, including several foreigners and a number of local politicians and elders.
"Somalis have long used hotels as homes and meeting places, and some of them almost feel like government ministries," says Mary Harper, the BBC's Africa Editor and a regular visitor to Somalia. "But often it's a false sense of security, as Al Shabab now knows exactly who is in these hotels and targets them almost constantly."
Most big hotels in Mogadishu have been hit by the militant group at least two or three times, as have many supposedly secure government compounds. All too often, Al Shabab finds gaps in the defences of such establishments via its formidable networks of spies, who range from street hawkers and security guards up to high-level sources in Somalia's intelligence services.
As Ms Harper reveals in Everything You Have told Me is True, her new book on Al Shabab, the group delights in ringing up journalists and politicians to tell them that it knows exactly what they have been doing each day, which hotels they have been seen at, and even what they had for lunch. Sometimes this Stasi-like tactic is just for intimidation; sometimes it is a prelude to assassination.
All of which provides a gloomy answer to the blunt question posed by the newly elected President Donald Trump in 2016, when a memo his aides sent to the US State Department asked: “We’ve been fighting Al Shabab for a decade, why haven’t we won?”.
It was typical of Mr Trump's crude, offhand approach to foreign affairs, but it was a fair point.
For the previous five years, the accepted wisdom had been that Al Shabab was fast withering. In 2011, African Union forces finally kicked the group out of Mogadishu, which it previously controlled half of. A year later, Al Shabab was also forced out of Kismayo, the southern port city that was its main stronghold. Not only was it losing territory, it was also losing popularity. When Al Shabab banned foreign aid agencies from its turf during Somalia's 2011 famine, it was blamed for the deaths of more than 250,000 people.
Yet with its "caliphate" now somewhat diminished, the group has been free to concentrate more on its guerrilla warfare campaign. Even today, its black flag still flies over large tracts of rural southern Somalia, the taxes it raises there freeing it from the need for external or international support. No other major jihadist group, be it ISIS, Al Qaeda or the Taliban, has controlled so much territory, uninterrupted, for so long. It has also proved powerful enough to have stopped a takeover attempt by ISIS, whose presence in Somalia is restricted to a few dozen followers in remote caves in the Puntland region.
True, Al Shabab's brutality is matched only by its duplicity. It denies religious brainwashing, but grooms children into its ranks with offers of smartphones. It frowns on letting people watch the World Cup, but organises public execution days and Quranic poetry reading classes, with weapons as prizes. In 2018, not long after slaughtering 500 Somalis in Mogadishu with a truck bomb, it announced a new "environmental" program banning single-use plastic carrier bags.
Yet, like the Afghan Taliban, the basic security Al Shabab provides is still often seen as preferable to rule by warlords or a corrupt and distant central government.
As Ms Harper points out, Al Shabab pays its followers up to $200 a month – more than the wages offered by Somalia's western-backed federal army. It welcomes recruits from minority clans, otherwise treated as second-class citizens. Its checkpoints do not routinely ask for bribes, or not as often as government-run ones do. Meanwhile, its court system is speedy and efficient compared to the government's secular version – so much so that many Somalis in Mogadishu travel to Al Shabab-controlled zones to settle disputes. Harper, who believes the group is so entrenched as to be undefeatable, adds that "in some ways, it has created the most effective form of governance Somalia has known since its collapse."
The parallels with Afghanistan do not end there. Just as Washington upped its Afghan drone war under former president Barack Obama, so too has Mr Trump increased the use of unmanned aircraft against Al Shabab, reducing the need for strikes to receive top-level clearance. In 2017, 60 militants were wiped out in a single strike near the former pirate port of Harardhere.
But, as with the Taliban, a hollowing out of the group's top leadership has not stopped Somalis joining its bottom ranks, sometimes in revenge for the civilian casualties caused by drone strikes. "It does put them on the back foot, but they do seem to be able to fill the leadership gaps," said Nuradin Dirie, a former advisor to the UN envoy to Somalia.
So how might Al Shabab's insurgency end? Mr Dirie thinks the only long-term solution is to negotiate. So far, though, peace talks have got little further than arranging the occasional ceasefire during Ramadan. While the group has some "reconcilables" – relative moderates, who might be peeled away – there is a hard core of transnational jihadists who will never lay down their arms. That hard core also remain active in the large Somali diaspora in neighbouring Kenya, where Al Shabab’s massacre of 67 people at Nairobi’s Westgate shopping centre brought the group to global notoriety in 2013.
Nor is militant Islam Somalia's only political problem. Somalia's government remains riven by tensions between its leadership in Mogadishu and the leadership of cities such as Kismayo, which want greater autonomy. While many believe a more devolved administration is the best way to defuse the clan tensions that have torn Somalia apart in the past, the current government is trying to centralise power again, says Mr Dirie. “These tensions are causing political instability that Al Shabab is able to exploit,” he added.
The other question, though, is just how much more patience the international community has. Until recently, Mr Dirie says, Somalia had a powerful friend in Britain, which, under the then prime minister David Cameron, launched a major international drive to get Somalia back on its feet. With the UK now consumed by Brexit, says Mr Dirie, that diplomatic momentum is now slowing. Mr Trump, he fears, may also disengage from Somalia if his drone campaign does not soon yield the desired results.
"The US and the UK were the two biggest countries involved in Somalia," he adds. "But the US doesn't care any more, and the UK is distracted."
True, the Somalia of today is not the febrile mess it was 20 years ago. Mogadishu, divided into warlords’ fiefdoms, now has a well-established diplomatic zone, and commercial life has returned to the capital. Members of the huge Somali diaspora – scattered round America, Europe, Kenya and the Gulf States – are drifting back.
But given that Al Shabab has survived the last 10 years of counter-insurgency measures, it may well survive another decade, or longer. Somalia’s long-staying hotel guests are unlikely to be checking out any time soon.
Colin Freeman is a foreign affairs journalist and former chief foreign correspondent of the Sunday Telegraph. He is the author of Kidnapped: Life as a Somali Pirate Hostage