No one saw it coming.
What was supposed to be a routine police raid in May to capture the Philippines' most wanted terrorist turned into a bloody, five-month war with consequences now reverberating across Asia.
On May 23, about a thousand Islamist extremists, many from Indonesia and Malaysia, stormed and captured large parts of the southern Philippine city of Marawi, after police tried to arrest Isnilon Hapilon, who had been designated by the Islamic State in Iraq and Syria (ISIS) as its top man in South-east Asia. The militants held on to a fortified position inside the city for five months, amid unrelenting air and land assaults by six army battalions.
By the time the military declared victory on Oct 23, more than 1,000 militants, government troops and civilians were dead, half of Marawi had been pulverised into rubble and dust, and about 400,000 people living in and near Marawi were forced to flee their homes.
The Marawi siege unfolded and ended as ISIS was being routed across Iraq and Syria by a global coalition to counter the terror group.
As the year draws to a close, ISIS' caliphate, run out of Raqqa in Syria, and which at its peak had eight million people under its control, is no more. The global horde of extremists that stood behind it is scattered. A few hundred are still fighting in the lawless borderlands between Syria and Iraq.
Number of dead militants, government troops and civilians by the time the military declared victory on Oct 23.
Number of people living in and near Marawi who were forced to flee their homes. Half of Marawi has been pulverised into rubble and dust.
Number of South-east Asians who have travelled to Syria and Iraq. Analysts say many will try to make their way to such conflict areas.
Number of people who have been allowed to return to Marawi.
Number of people who are still living outside the city. Most are languishing in crowded, barely liveable evacuation centres, and living off handouts and aid.
But most are fleeing back home, to Europe, northern Africa and Asia. Some have found their way to the insurgency-wracked southern Philippine island of Mindanao.
Around 1,000 South-east Asians have travelled to Syria and Iraq, and analysts say many will try to make their way to such conflict areas.
The caliphate may have all but evaporated, and the network that allowed ISIS to fund the attack on Marawi decimated. But the zealotry endures, morphing into insurgencies across the globe.
It will also continue attracting others, such as Singaporean Imran Kassim, 34, the managing director of a logistics company who harboured intentions of joining the militants in Marawi and was arrested in Singapore by the Singapore authorities in July.
In the Philippines, the militants who managed to flee from Marawi are already regrouping and recruiting new fighters. Colonel Edgard Arevalo, the Philippine military spokesman, said "recruitment videos" have already been spotted on Facebook.
The militants are fanning resentment among Muslims who lost so much because of the war in Marawi.
As of last week, about 92,000 people have been allowed to return to Marawi. Over 100,000 more, however, are still living outside the city. Most are languishing in crowded, barely liveable evacuation centres, living off handouts and aid.
The Philippine government is putting together a plan to rebuild Marawi. But this plan is coming out as just bits and pieces of an incoherent whole.
Professor Sorhaila Latip Yusoph, 40, who teaches communication studies at Mindanao State University in Marawi, considers herself lucky that she has a job to fall back on, even as her house was levelled to the ground by the fighting in Marawi.
But resentment among those who similarly lost everything is growing, she said.
"I'm afraid if this government will not give just compensation to those who lost a lot of things, this might just be the beginning of many things here," she said.