The bodies of at least 12 loyalists to the former Libyan leader Muammar Gaddafi have been found in the country's capital, Tripoli, only days after they were released from prison.

The victims were part of a group who had been held at the al-Ruwaimi prison, Tripoli's general prosecutor confirmed.

Libya's internationally backed Government of National Accord (GNA) issued a statement condemning the murders and ordered an investigation into the deaths.

READ MORE: Libya - Gaddafi left behind a long, damaging legacy

Omar Turbi, a former adviser to the Libyan government, said it is not surprising that the murders had happened given the deteriorating situation in Libya.

"Libya has become a rogue state. There's no functioning security system, there's no effectively functioning legal system," Turbi told Al Jazeera.

"It is a sad day in Libya to see people [killed who] have already been tried, and found to be clearly innocent. There is no evidence of anything they were accused of."

Although some Gaddafi loyalists were responsible for committing atrocities, he said, the manner in which the 12 men lost their lives was unjust.

Battle for Sirte

The report of the deaths comes against a background of fierce fighting for control of Gaddafi's home city, Sirte.

Forces loyal to the GNA say they have recaptured both Sirte's port and airport from the Islamic State of Iraq and the Levant (ISIL), forcing the armed group, also known as ISIS, to retreat after more than two years.

Government forces say they have made a breakthrough after weeks of air strikes, shelling and street battles.

"ISIL used to have their own strategy, but not any more. Now they're very exhausted. We're dealing with ISIL the same way we dealt with the previous regime," Ali bin Gharbiya, a commander for GNA forces, told Al Jazeera.

Martin Kobler, the UN envoy to Libya, said on Saturday on Twitter that he was "impressed" by the "rapid progress" of the Libyan forces.

The fall of Sirte would be a major setback for ISIL, who have also lost territory in Syria and Iraq, where they have declared a "caliphate".

"We will liberate the city of Sirte from ISIL and its terrorism. We will clean up all of Libya and defeat anyone who opposes us in our country," Omar Rhaal, a fighter for the GNA, said.

Foreign intelligence services estimate ISIL has 5,000 fighters in Libya, but its strength inside Sirte, which ISIL has held since June 2015, is unclear.

A total of 137 UN-backed government forces have been killed and 500 wounded since the beginning of the operation to take back the city on May 12, according to a medical official in the western city of Misrata.

READ MORE: Can Libya's new government end the chaos?

George Joffe, a lecturer at the University of Cambridge, said ISIL's retreat in Libya could result in the formation of a new Libyan army.

"It means that the new government in Tripoli has acquired credibility," he told Al Jazeera.

"We know that two other militias in the east have now decided to join up with the Misrata militia, and there, we are seeing a nucleus perhaps of a new Libyan army beginning to be formed."

The fall of Gaddafi's regime in 2011 left Libya in disarray.

ISIL managed to flourish in a political and security vacuum. The GNA is trying to unite Libya's many factions.