Libyans shop for fruits and vegetables at a market in Sabratha, west of the capital Tripoli, on February 29, 2016
Sabratha (Libya) (AFP) - For four days and nights, terrified residents of Sabratha huddled in their homes as Islamic State group fighters battled local militias after briefly overrunning the centre of the Libyan city.
But life is slowly returning to normal in the city, famous for its magnificent Roman ruins, since security forces declared at the weekend that the jihadists had been fought off.
"We were terrified. We were afraid for our children and families," resident Usama al-Jedi told AFP as he shopped for vegetables at a local market.
"We were fortunate to re-establish security and, God willing, they won't return."
Around 200 IS fighters last week briefly seized central Sabratha, 70 kilometres (40 miles) west of Tripoli, before being repulsed to its outskirts by local militiamen.
The assault came days after a US air strike destroyed a suspected IS training camp in the outskirts of the city, killing around 50 including alleged senior members, and locals said they were stunned at the jihadist advance.
"It was a shock for everyone. (IS) were in buildings at the edge of town and suddenly they appeared in the centre of Sabratha to proclaim their 'emirate'," Mohammad, commander of a local militia loyal to authorities in Tripoli, told AFP.
Libya has had two rival parliaments and governments since 2014 when an Islamist militia-led alliance overran the capital and forced the internationally recognised administration to take refuge in the remote east of the oil-rich nation.
Extremist groups including IS have exploited the power vacuum, making gains in coastal areas as the United Nations struggles to get both parliaments to sign up to a national unity government aimed at restoring stability.
In Sabratha, a city of about 100,000 which falls under the control of the Fajr Libya alliance installed in Tripoli, many families were holed up at home for four days as local militias fought IS back.
On Sunday, the day after authorities declared "victory", most markets and shops were open again, although few customers ventured into the streets.
Schools would remain closed until a "total normalisation of the situation", authorities said, and banks should reopen in the coming days.
Sabratha mayor Hussein al-Daoudi called on dazed residents to make a concerted push to return to normal life in the city still reeling from the jihadists' lightning assault.
- IS 'sleeper cells' -
Since the NATO-backed ouster of longtime dictator Moamer Kadhafi in 2011, Libya has been plagued by violence and lawlessness leading to a mass exodus of migrants seeking to flee across the Mediterranean.
Western leaders fear the disorder could enable IS to establish a launchpad for attacks on Europe's doorstep.
European officials agree on the need for military action to dislodge IS in Libya, but would prefer a national unity government in place to request assistance before formally intervening.
The group has headquartered itself around Sirte, the former coastal hometown of Kadhafi, and has been battling forces loyal to the internationally recognised government in second city Benghazi as well as Derna, further east.
Authorities in Sabratha said IS was able to seize the city centre by activating "sleeper cells" as local militia went after jihadists thought to be hiding in its outskirts.
"The fighting was tough. We've fought against Kadhafi and against others but this battle was totally different. The jihadists were desperate," Mohammad said.
"We weren't afraid to die. We captured some and killed others. The rest have tried to hide but we will chase them," he added.
Around 40 militiamen loyal to the Tripoli government died during the clashes, with an unknown number of jihadists also killed.
The entrances to Sabratha are now controlled by checkpoints manned by local fighters dressed in military fatigues and civilian clothes.
But locals fear they haven't seen the last of IS.
One resident, who wished to remain anonymous, blamed the political class for neglecting Sabratha and allowing the jihadists -- briefly, for now -- into the heart of the city.
"What we're seeing is only the result of political chaos," the resident said. "It's the politicians who are mainly responsible. They paved the way for extremists."