Maute rebel group: A rising threat to Philippines
Losing control of a major city to a small insurgent group that was hardly known two years ago is an embarrassment to the Philippines government and armed forces.
Even on Mindanao, where tens of thousands have been killed over five decades of armed conflict, the week-long battle for Marawi stands out as a fiasco.
The army, though, now believes it unwittingly interrupted a plan by the Maute group to take over the city and sack it.
Soldiers were following a tip-off that Isnilon Hapilon, leader of the notorious Abu Sayyaf Group and the most wanted insurgent leader in the Philippines, was in Marawi.
They had gone in to try to capture him, and were surprised by the number of Maute group fighters inside the city. The result was a week of fierce clashes, air strikes, summary executions and tens of thousands of displaced people.
So who are the Maute group? And why are they important on an island which is home to dozens of well-armed groups?
A tradition of armed resistance to central government authority goes back centuries in Mindanao.
The Spanish colonial administration barely maintained a presence on the island, and the US administration which replaced Spain fought brutal battles with the Moros, as the various Muslim clans of Mindanao are generally called.
In the late 1960s the Moros rose up again against the government - after years of settlement by Christians from other parts of the Philippines had left Muslims a minority on Mindanao - under a new nationalist movement, the MNLF.
That armed struggle, costing tens of thousands of lives, has continued more or less to the present day, with occasional breakthroughs - like the 1996 peace agreement with the MNLF leader Nur Misuari, and the more recent Comprehensive Agreement on Bangsamoro in 2014 with the MILF, once a breakaway group from the MNLF and now the largest armed organisation on the island.
That deal is stalled, but is supposed to create an autonomous Moro state on Mindanao.
President Rodrigo Duterte has promised to make peace on the island a priority, but his view of the 2014 deal is not clear as he talks about broader federalism for the Philippines.
All those years of conflict have created a warrior culture among young men, and flooded Mindanao with weapons. Private armies and militias wield more power than the official security forces in many areas.
They have also created fertile ground for radical Islam.
Best known of the radical groups is Abu Sayyaf, founded in 1991 and named after a mujahideen commander in Afghanistan.
It was linked to al-Qaeda through support given by Osama bin Laden's brother-in-law.
It used to operate only in the far south-west, on the islands of Sulu and Basilan, and became known for a series of kidnappings of foreigners for ransom and for beheading their captives.
US forces were deployed to the area in 2002 to help the Philippines military deal with Abu Sayyaf.
Despite the deaths of many fighters and commanders, the group continues to fight, though it has now broken into rival factions over the decision in 2014 by Isnilon Hapilon to swear allegiance to so-called Islamic State (IS), and to declare himself the "amir" of a South East Asian caliphate.
But when Hapilon moved to Lanao del Sur, on the main island of Mindanao, apparently after being badly injured in a firefight at the end of last year, a new and potentially dangerous alliance emerged, bringing Abu Sayyaf together with three other small, hardline insurgent forces, who reject peace talks with the government and advocate a Salafi form of Islamic rule.
The Maute brothers
The Maute group is one of them, and, say experts who monitor Islamic groups in the region, the most potent.
It was founded five or six years ago by Omar and Abdullah Maute, natives of Lanao del Sur and members of the Maranao clan.
They both studied in the Middle East: Omar at Al-Azhar University in Cairo, and Abdullah in Jordan. They both speak Arabic, unlike Isnilon Hapilon, and are well-versed in Salafi and jihadist ideology.
They are believed to have many connections with IS supporters in the Middle East.
The Maute brothers also have strong family ties to some of the top MILF leaders, which, until recently, gave them access to the resources and training areas of the mainstream insurgent group.
They are believed to have formed a close relationship with a well-known Indonesian radical, Sanusi, who was killed by police at the Mindanao State University in Marawi in 2012.
The Mautes probably started carrying out terrorist attacks in Mindanao in 2013. But they first grabbed national attention in the Philippines when they raided the prison in Marawi in August last year, freeing 23 inmates.
They were then blamed by the authorities for a bomb attack in Davao, President Duterte's hometown, in September, which killed 14 people.
They took over the town of Butig late last year, and again in January this year, and despite heavy losses, have continued to clash with the troops sent in to deal with them.
Their apparent plan to take over Marawi, coinciding with the Muslim holy month of Ramadan, would have been a huge propaganda coup; their tenacious resistance to the army in Marawi may also now be used to attract more recruits.
'Turning a blind eye'
Perhaps more significantly, they have a number of foreign militants fighting with them, mainly from Indonesia and Malaysia.
They are believed to have received training from a skilled Malaysian bomb-maker called Zulkifli "Marwan" Abdhir, who was killed by the police in 2015.
Another Malaysian radical, Dr Mahmud Ahmad, is still thought to be with them.
Sidney Jones, who runs the Institute for Policy Analysis of Conflict in Jakarta and is perhaps the best-informed expert on Islamic extremists in South East Asia, believes the Maute group now has overseas sources of funding, probably from Indonesia, she says, but possibly Syria.
The Mautes, she says, are the brains behind the attempt to establish an alliance loyal to IS in Mindanao, not the self-styled "amir" Isnilon Hapilon, for whose capture the US is offering a $5m (£3.9m) reward.
She believes the Philippines government has underestimated the strength of the Mautes, and their capacity to act as a crucible for terrorist actions across the region.
Ms Jones says that today Indonesian militants are able to travel freely to the Philippines, on scheduled flights, to buy weapons in Mindanao.
Her fear is that as IS is forced to retreat further in Syria and Iraq, the hundreds of Indonesian and Malaysian militants fighting there will come home, and be looking for new opportunities to wage jihad.
The Maute group and its new alliance will offer an ideal partnership for them.
"President Duterte's declaration of martial law is just a band-aid," Ms Jones says.
"The government has turned a blind eye to how these groups have united; it keeps downplaying the threat they pose. But these four groups together now have a geographic reach pro-IS groups in the Philippines have never had before."
It is worth remembering that the last time South East Asia faced a sustained terrorist threat, it also germinated in Mindanao.
Jemaah Islamiyah, the group that carried out the devastating Bali bombing in 2002, which killed 202 people, most of them tourists, originated in Indonesia and Malaysia in the 1980s.
But it learned its lethal bomb-craft from veterans of the Afghan war, mostly in training camps inside MILF-controlled areas.
Today the MILF is more wary of hardline militants within its ranks as it pursues a still elusive final autonomy settlement with the government.
The Mautes have been expelled from MILF areas in the past, and get little co-operation today.
But while poverty and violence still afflict the southern Philippines, the radical groups will appeal to many young Muslims, and pose a significant threat to the mainstream MILF leadership, to other parts of the country vulnerable to terrorist bombings, and even to the wider region.
Who are the Maute group? - BBC Monitoring
- Also known as IS Ranao, the group is based in Mindanao's Lanao del Sur province
- Formed in 2012 by Abdullah Maute (aka Abu Hasan) and his brother Omar
- Ranks are believed to comprise a few hundred fighters, mostly from other armed Islamist groups
- The group's first known encounter with the military came in 2013, when it attacked a security checkpoint in Mindanao
- Pledged allegiance to IS in 2015
- In February 2016, troops overran the group's Butig headquarters, killing around 40 rebels
- The group has also been linked with Isnilon Hapilon, a prominent figure in the Abu Sayyaf militant group