The United States on Monday vowed to support Mozambique after a prolonged deadly assault on the key northern town of Palma by Islamic State-linked militants waging an escalating insurgency.
The town was all but deserted five days after the raid was launched, its residents fleeing by road, boat or on foot.
The militants attacked the town on Wednesday, spiralling an insurgency that has spread bloodily across northern Mozambique since 2017.
Dozens of people, according to the IS and the authorities, were killed in what witnesses describe as a coordinated attack, and an unknown number were still missing.
It is the biggest and closest raid yet to a multi-billion-dollar gas project being built on a peninsula just 10 kilometres (six miles) away, by France's Total and other energy giants.
"The caliphate's soldiers seized the strategic town of Palma," IS said in a statement posted on its Telegram channels.
It claimed its offensive aimed at military and government targets, killing dozens of troops and "members of Crusader states," its term for Western nationals.
"We remain committed to working together with the government of Mozambique to counter terrorism and violent extremism and defeat ISIS," Pentagon spokesman John Kirby said.
The town of 75,000 people in Cabo Delgado province was all but emptied of its population, said civil society activist Adriano Nuvunga.
"The violence has ceased, but it is believed some of the insurgents have pulled back and some are still around in hiding," he told AFP.
Witnesses said scores of fighters had sneaked into the town ahead of the attack.
"The attackers arrived a few days earlier and hid in the homes of locals whom they paid," said one Palma resident, speaking from Mueda, where he had taken refuge.
"The attacks started along the main roads to Palma," he said.
As police rushed out to try repel the invaders, the fighters inside the town mounted their own attack, according to witnesses.
The United Nations condemned the assault on Palma and said it was coordinating closely with local authorities to provide assistance to those affected by the violence.
"We are deeply concerned by the still evolving situation in Palma where armed attacks began on March 24, reportedly killing dozens of people," UN spokesman Stephane Dujarric said.
- Struggle to survive -
Many survivors said they had walked for days through forest to seek refuge in Mueda, 180 kilometres (112 miles) to the south, where they arrived limping on swollen feet.
"Many people fell from fatigue and were unable to continue walking, especially the elderly and children," said one escapee in Mueda who did not wish to be named.
Some survivors fled to the gas project site, from where they are being sent to the regional capital Pemba via boat.
The government said dozens were killed in the militants' attack, including seven people caught in an ambush during an operation to evacuate them from a hotel where they had sought refuge.
A South African is among those killed, his family said.
Attacks started shortly after a large shipment of food landed to the farthest northern coastal town which has for months been inaccessible by road due to insecurity.
Lionel Dyck owner of a private military company helping Mozambique fight the insurgency, told the BBC that food truck drivers were beheaded during the attack.
Witnesses told AFP they first targeted banks and the police station before spreading across town.
- Boatloads -
Thousands of escapees were arriving on boats on Monday in Pemba, the provincial capital around 250 kilometres to the south, according to sources there. Up to 10,000 others were awaiting evacuation, according to aid agencies.
Pemba is already packed with hundreds of thousands of other people displaced by the Islamist insurgency, which has uprooted nearly 700,000 from their homes across the vast province.
The attack forced expatriate workers and locals to seek refuge temporarily at a heavily guarded gas plant located on the nearby Afungi peninsula.
"A significant number of civilians rescued from Palma are also being transported to Afungi site, where they receive humanitarian and logistical support," side Total in a statement.
The latest attack "will unleash a new onslaught of displaced people," said Chance Briggs of the British-based charity Save the Children.
UNICEF's boss Henrietta Fore, fears the impact of the attack on children "will be brutal".
The defence ministry said late Sunday the security forces had "reinforced their operational strategy" to contain the attacks and restore normality in Palma.
- Ruthless campaign -
The brutal, calculated raid broke a three-month hiatus in Islamist attacks widely attributed to the January-March rainy season.
Although the extremists launched their campaign in 2017, experts say they began mobilising a decade earlier when disgruntled youths started to practise a different form of Islam, drinking alcohol and entering mosques dressed in shorts and shoes.
Their bloody campaign has claimed at least 2,600 lives, half of them civilians.
The insurgents are known locally as al-Shabab, although they are not believed to have links with the Somali jihadist organisation by that name.
The US State Department this month said the group reportedly pledged allegiance to IS in April 2018. It named its leader as Abu Yasir Hassan, and declared him a global terrorist.