Somalia’s Al-Shebab insurgents retook their former stronghold of Merka on Friday from African Union troops who pulled out of the port they had held for three-and-a-half years, the governor said.

The loss of Merka, the regional state capital of Lower Shabelle, is one of the biggest setbacks for the AU force in its nearly decade-long battle against the Shebab.

“The AU troops pulled out of the town and Shebab militants entered — and have secured control without fighting,” Ibrahim Adam, governor of the Lower Shabelle region told reporters.

The historic port, some 100 kilometres (60 miles) south of the capital Mogadishu, was captured in August 2012 by African Union troops.

It is one of the first first major towns the Shebab have seized back and it gives them access to a sea port again.

There was no immediate response from AMISOM or government officials.

Residents confirmed the takeover, saying heavily armed Shebab fighters swept into the town with Islamist black flags, before addressing residents.

“AMISOM forces moved out at midday and the local administration and all other Somali security forces left a few minutes later – and then heavily armed Shebab militants entered the town,” said Ibrahim Mumin, a local.

“They have been addressing residents at the district headquarters.”

The Shebab are fighting to overthrow the internationally-backed government in Mogadishu, which is protected by 22,000 AU troops.

The insurgents have lost ground since being routed from Mogadishu in 2011 but continue to stage regular shooting and suicide attacks, and in recent months staged a series of brazen raids on AU bases.

Last month they stormed a Kenyan army base at El-Adde in southwest Somalia, in the latest incident of an AMISOM base being overrun, before retreating.

In September, Shebab fighters stormed a Ugandan AMISOM base in Janale district, 80 kilometres (50 miles) southwest of Mogadishu in the Lower Shabelle region.

And in June 2015, Shebab killed dozens of Burundian soldiers when they overran an AMISOM outpost northwest of Mogadishu.