They were supposed to be short of weapons, ammunition and food.
But in just 48 hours, Mozambique's Islamist militants captured a key town near where foreign oil workers are developing a multi-billion dollar gas project, outwitting the army, police and teams of private security contractors.
Infiltration and then surprise
The coordinated attack last week on the northern Mozambique town of Palma left dozens dead, scores missing and sent thousands fleeing by boat, foot and road to escape a major escalation in the country's three-year insurgency.
Militant tactics proved highly effective: infiltration and then surprise.
Islamic State claimed the assault that began on Wednesday. But accounts given by multiple witnesses, residents and sources say jihadists sneaked into the town days earlier, laying in wait for the time to attack from within.
Paying off local residents, militant fighters hid in local homes in Palma, a coastal town in Cabo Delgado province that despite its potential wealth remains poor and majority muslim.
By Wednesday, they were ready. A simultaneous attack was launched from multiple points from outside the town.
"The attackers arrived in the city a few days earlier and hide in the homes of the people they paid," said one Palma resident who asked not to be identified.
"When the attacks started along the entry roads into Palma, those inside the town also started to attack, while the police had already left to try to defend the invasion of the town."
Similar tactics were used by militants in August when they attacked and took over the port of Mocimboa da Praia, just 50 kilometres to the south.
That attack had been seen a major strategic victory for a militancy that was until recently considered to be fairly disorganised.
When the Palma assault began, Mozambique security forces rushed to the counter the three attack points on the outskirts of the town of 75,000 people, leaving the centre vulnerable.
Almost immediately, militants waiting inside Palma struck, hitting banks and police stations.
It was a major assault on a town where foreign gas workers reside as part of the huge liquified gas project being developed by France's Total and other oil companies on the Afungi peninsula just 10 kilometres away.
"Where are the pigs?"
Witnesses and sources said militant fighters first emerged from hiding in Palma making sure no armed forces were nearby.
"Where are the pigs? Are there "cassava" here?" they asked residents using a Swahili term for local security forces who support the army in the fight against jihadists.
Just before the attack began, a ship loaded with food for some of the thousands of people displaced by the conflict was also arriving in the Palma port.
Some of the supplies were also meant for local business. For several months, Palma has been almost cut off with the three main roads out impassable due to insecurity and supplies are sometimes complicated.
The price of basic necessities has skyrocketed.
On Wednesday, attackers arrived with trucks, ready to take supplies from the ship and other sources.
As the attack unfolded, around 200 people, including some foreign workers, fled to take refuge in the city's main Amarula Hotel, which is en route to the airport.
But heavily armed attackers managed to prevent several attempts to evacuate people by helicopter as they bunkered down in the hotel.
After 48 hours of hell, some decided to make a desperate attempt to escape on Friday evening, in a convoy of trucks and vehicles.
But the escape bid turned into a tragedy: At least seven people were killed, more than sixty are still missing, after the convoy was ambushed by militant gunmen.
The government says dozens of people have died during the past four days of fighting over Palma.
But that toll is likely to rise as it does not reflect the level of violence during the raid, according to survivors.
Palma is now a ghost town, with the remains of the dead laying in its streets.
"When we got there on the first day they were bodies lying on the road," former South Africa army officer Lionel Dyck, head of a private military company Dyck Advisory Group (DAG), which is helping Mozambique fight the insurgency, told the BBC.
"There were some food trucks ...so the drivers of those trucks were lying next to their vehicles without heads."