"Two Italian hostages were released... In Sabratha after an operation targeting several houses after information reached security forces that Daesh elements were there," the city's mayor Hussein al-Dawadi said, using an Arabic acronym for IS.
"They are now at a police station in Sabratha," 70 kilometres east of Tripoli, he added.
Gino Pollicardo, 55, and Filippo Calcagno, 65, said in a statement released by the Sabratha municipality: "We are free and are relatively well physically but are psychologically exhausted. We urgently need to return to Italy."
Italy said on Thursday that the two others had likely been killed in clashes between IS fighters and local militia fighters near Sabratha.
Sabratha has been the scene of intense fighting between local militias and IS jihadists since a US attack last month on an IS training camp on the outskirts of the city that left 50 people dead.
IS subsequently seized control of the centre of the city only to be pushed back to the outskirts last week.
