Gunmen killed 12 Libyans after their release from jail for taking part in acts of repression during the 2011 revolt against Muammar Gaddafi, officials said on Sunday.

A Tripoli court ordered the conditional release of the former government officials on Thursday, and on Friday their bullet-riddled bodies were found in the capital, the prosecution said on its Facebook page.

An investigation into the murders has begun, it added.

The victims had been imprisoned on charges of committing abuses during the NATO-backed uprising that toppled and killed Gaddafi.

They were freed on condition that they report to the prosecutor every two weeks.

UN special envoy to Libya Martin Kobler condemned the murders and called for a prompt and "transparent" investigation.

Kobler tweeted that he was "shocked and dismayed by the reports of murder of so many detainees released by a Tripoli court".

The Government of National Accord also denounced what it called a "despicable crime".

A statement on its Facebook page called on security and judiciary authorities to find the assailants and bring them to justice.

Seddiq es-Sour, of the prosecutor's office, told Libyan television the bodies were found in various parts of the capital and confirmed that all were former prisoners.

He said they had been arrested between 2011 and 2014.

The identities of the victims were not immediately released.

Earlier this month, es-Sour said the supreme court had ordered the release of six Gaddafi-era officials pending an appeal, for reasons linked to their health and age.

Dozens of people are on trial in Libya for their roles in the violent suppression of the revolt, including two sons of Gaddafi and ex-government officials.

In July 2015, several people were sentenced to death, including Seif al-Islam, Gaddafi's son and one-time heir apparent.