Forces allied with Libya's unity government said Saturday they had recaptured the port in the jihadist stronghold of Sirte from Islamic State group fighters encircled inside the city.
The fall of Sirte, the hometown of ousted dictator Moamer Kadhafi, would be a major setback for the extremists who have also lost territory in Syria and Iraq where they have declared an Islamic "caliphate".
The Libyan forces also retook residential areas in the east of Sirte, which for the past year has been the main IS base in the North African country, a spokesman for the forces, Rida Issa, told AFP.
The jihadists are now surrounded in a densely populated area of around five square kilometres (two square miles) inside the city where they are laying booby traps, he said.
Most of the city's residents have fled but about 30,000 remain, he said.
After a month-long operation to close in on Sirte, the rapid pace of the advance by forces allied to the Government of National Accord (GNA) who entered the city on Wednesday has surprised Libyan authorities.
"The battle wasn't as difficult as we thought it would be," a government official said. "Maybe we exaggerated their (IS's) numbers?"
The UN envoy to Libya, Martin Kobler, said Saturday on Twitter that he was "impressed" by the "rapid progress" of pro-GNA forces.
But analysts have warned the city's fall would not spell the end of the jihadists in Libya, where they have fed on political and military divisions since the 2011 uprising that killed Kadhafi.
Foreign intelligence services estimate the extremist group has 5,000 fighters in Libya, but its strength inside Sirte, which IS has held since June 2015, is unclear.
IS fighters tried to wrest back the port on Saturday in an attack that killed two members of the GNA forces, who repelled the assault.
A total of 137 pro-GNA forces have been killed and 500 wounded since the May 12 beginning of the operation, according to a medical official in the western city of Misrata.
Libya's unity government forces have fought fierce street battles with the jihadists around a sprawling Kadhafi-era conference centre which once hosted international summits but now houses an IS command centre.
An AFP correspondent at the scene reported heavy street fighting on Friday about two kilometres (one mile) from the Ouagadougou centre.
GNA forces used tanks, rocket launchers and artillery, the correspondent said, while the jihadists responded with machineguns, mortar rounds and sniper fire.
"We are fighting between houses, on the streets, and we won't back down before we eliminate them," said one GNA combatant, who declined to be named.
Warplanes have carried out air strikes around the conference centre and other IS positions inside the city, according to social media accounts belonging to the anti-jihadist operation.
The operations command, on its Facebook page, said jihadist positions had been targeted in a total of 150 air strikes since mid-May.
Formed under a UN-backed power-sharing deal agreed by some Libyan lawmakers in December, the GNA has been working to assert its authority but has yet to receive the official endorsement of the country's recognised parliament.
The pro-GNA forces are mostly made up of militias from western cities, notably Misrata, and the guards of oil installations that IS has repeatedly tried to seize.
Emily Estelle, a North Africa and Middle East specialist with the Washington-based American Enterprise Institute, said an estimated 2,000 fighters, primarily Misrata militiamen, were engaged in the Sirte operation.
The forces allied with the GNA said on Thursday they expected to announce the liberation of Sirte in "two or three days," after thrusting into the city centre.
"We're encouraged by the progress they're making," said US special envoy Brett McGurk.
"Once you have a credible force on the ground that moves against them (IS), there is a chance that they could crack pretty quickly."
GNA head Fayez al-Sarraj called Friday on "all military forces to unite in the face of our common enemy... and to join the victorious forces".
But Ahmed al-Mesmari, a spokesman for forces loyal to a rival government based in the country's far east, described the GNA forces as "illegitimate militias, loyal to an illegitimate government".