The Yemeni branch of al-Qaeda took over three towns in the south of the country before being forced to withdraw from two of them on Friday, officials have said.

The Thursday attacks on Loder, Shaqra and Ahwa came just days after a US raid on a jihadist base in central Yemen which left one Navy Seal and up to 30 civilians dead.

The province of Abyan where the towns are located was mostly liberated from al-Qaeda forces last summer with the help of Saudi-led coalition air strikes.

However, a security official said that the jihadis were able to take advantage of the fact government troops had deserted their posts in protest over unpaid wages.

“Our forces are also angry that they have not been provided with the weapons and other equipment to confront the extremists, who have been stepping up their armed attacks,” the official told AFP.

Fighters set up roadblocks and blew up two buildings in the surprise attacks, he continued.

However, air strikes on Loder and Shaqra overnight as well as protest demonstrations from local residents threatening to take up arms managed to dislodge the fighters.

Al-Qaeda has gained a significant foothold in Yemen, flourishing in the chaos of the country’s civil war, which has pitted Shia Houthi rebels against the internationally recognised exiled government.

The world has forgotten the Yemen war, says senior UN humanitarian official

US drone strikes have continually targeted al-Qaeda bases and supply lines in the country but have not succeeded in dampening the group’s activity.

Thursday’s attacks follow the first military operation carried out by US President Donald Trump, a raid on an alleged al-Qaeda base in central Yemen which has been criticised for allegedly causing the deaths of up to 30 civilians.

“Almost everything went wrong,” a US official told NBC News on background.

As well as the unconfirmed reported civilian casualties and the death of 36-year-old Navy Seal Owen Williams, the MV-22 Osprey involved apparently landed hard, injuring those on board, and later had to be destroyed by a remotely dropped bomb.

The situation in Yemen Show all 14 1 /14 The situation in Yemen The situation in Yemen Houthi supporters trample on a US flag during a gathering mobilizing more fighters into several Yemeni battlefronts, in Sana'a, Yemen EPA The situation in Yemen People carry the coffins of men, who were killed in the recent Saudi-led airstrikes during their funeral, in the Old City of Sanaa, Yemen AP The situation in Yemen Pro-government fighters give food to Yemeni children on the road leading to the southwestern port city of Mokha. Yemeni rebels are putting up fierce resistance in a key Red Sea port city where they are encircled by pro-government force Getty Images The situation in Yemen A Yemeni stands in front of a graffiti protesting US military operations in war-affected Yemen, in Sana'a, Yemen. According to reports, US Special Forces troops allegedly disembarked from US helicopters in the Yemeni town of Yakla and attacked several houses belonging to members of the terrorist group Al-Qaeda, killing three high-ranking Al-Qaeda members and nine civilians, six women and three children. One American serviceman has been killed and three injured in the attack EPA The situation in Yemen US Special Forces troops allegedly disembarked from US helicopters in the Yemeni town of Yakla and attacked several houses belonging to members of the terrorist group Al-Qaeda, killing three high-ranking Al-Qaeda members and nine civilians, six women and three children. One American serviceman has been killed and three injured in the attack EPA The situation in Yemen A Yemeni female fighter supporting the Shiite Huthi rebels, and carrying weapons used for ceremonial purposes, takes part in an anti-Saudi rally in the capital Sanaa Getty Images The situation in Yemen Yemeni female fighters supporting the Shiite Huthi rebels, and carrying weapons used for ceremonial purposes, take part in an anti-Saudi rally in the capital Sanaa Getty Images The situation in Yemen A boy shouts slogans next to pro-Houthi fighters, who have been injured during recent fighting, during a rally held to honour those injured or maimed while fighting in Houthi ranks in Sanaa, Yemen Reuters The situation in Yemen Balls of fire and smoke rise from a Houthi-held military camp following alleged Saudi-led airstrikes, in Sana'a, Yemen EPA The situation in Yemen Yemenis search under the rubble of damaged houses following reported Saudi-led coalition air strikes on the outskirts of the Yemeni capital Sanaa Getty Images The situation in Yemen A Yemeni boy looks on as Yemenis search under the rubble of damaged houses following reported Saudi-led coalition air strikes on the outskirts of the Yemeni capital Sanaa Getty The situation in Yemen A Yemeni boy sits amidst the rubble of damaged houses following reported Saudi-led coalition air strikes on the outskirts of the Yemeni capital Sanaa AFP/Getty The situation in Yemen Marine One with US President Donald Trump flies with a decoy and support helicopters to Dover Air Force Base in Dover, Delaware, for the dignified transfer of Navy Seal Chief Petty Officer William 'Ryan' Owens who was killed in Yemen Getty Images The situation in Yemen US President Donald Trump aboard the Marine One to greet the remains of a US military commando killed during a raid on the al Qaeda militant group in southern Yemen on Sunday, at Dover Air Force Base, Delaware, US Reuters

The mission had originally been intended to capture intelligence and computer equipment, which this week the White House defended as a success.

“Knowing that we killed an estimated 14 [Al-Qaeda] members and that we gathered an unbelievable amount of intelligence that will prevent the potential deaths or attacks on American soil – is something that I think most service members understand, that that’s why they joined the service,” White House Press Secretary Sean Spicer told reporters.

Eight-year-old American citizen Nawar al-Awlaki, daughter of infamous al-Qaeda cleric Anwar al-Awlaki, who died in Yemen in 2011, was reportedly among those killed in the weekend’s botched mission.

Since the introduction of Mr Trump’s so-called ‘Muslim ban’ travel restrictions for citizens of certain countries, Jihadist-friendly social media channels have suggested that Anwar al-Awlaki’s prediction that “the West would eventually turn against its Muslim citizens” was coming true.