The head of Sabratha council said two Italian hostages were freed on Friday from Islamic State group custody in the western Libyan city.

Hussein al-Zawadi told The Associated Press that Gino Pollicardo and Filippo Calcagno were freed from a house in a northwestern district of Sabratha. The area has seen fierce fighting between IS fighters and Sabratha's local forces, a coalition of militia and forces loyal to the government in Tripoli.

The Italians had managed to break down the front door themselves, and local fighters came to their aid after being tipped-off by neighbors, al-Zawadi said.

He said the Italians were in a "good condition" although they had not eaten in a week.

"They are in a safe place now and undergoing medical treatment," al-Zawadi said. "They will be transferred to their country sometime soon," he added.

He also confirmed that two other Italian hostages had been killed in recent clashes between IS militants and Sabratha's local forces.

On Thursday, the head of the so-called "Sabratha Media Center" said the local militia fighting Islamic State group ambushed two IS cars in a desert highway, 35 kilometers (22 miles) south of Sabratha, killing all nine people in the vehicles. The bodies of the two Italians were later found, with weapons in their hands, said the head of the media center, Esam Krair.

"We will contact the Italian authorities and hope they recover the bodies for investigation," added Krair.

The four Italians -- the two escaped hostages and the two found killed --  were working for the Italian construction company Bonatti when they were kidnapped July 1 near an industrial complex owned by energy giant Eni in the western Libyan city of Mellitah.

Last month, Serbian officials said that U.S. airstrikes on IS positions there killed dozens of militants as well as two Serbian hostages.

Later in February, a militia loyal to the Islamist-backed government in the capital, Tripoli, said it had arrested the leader of the Islamic State branch for Sabratha after IS tried to take over the city, storming its security headquarters and beheading at least 12 militiamen.

Libya fell into chaos following the 2011 toppling and killing of dictator Moammar Gadhafi. Since 2014, its divisions have only increased. It split into two governments and parliaments -- the internationally recognized one in the country's east, and an Islamist-backed one in Tripoli.

Each side is backed by an array of different militias. IS has surged in the chaos, claiming responsibility for a series of deadly attacks as it tries to expand its territory and take control of oil terminals and fields, the sole source of Libya's wealth.