Updated

A former judge, aged 79, was gunned down as he left a mosque in the restive eastern city of Benghazi on Monday, a Libyan security services spokesman said.

"Fethi Lekhfifi, a former judge, was shot dead as he came out of a mosque in Benghazi at dawn," said Colonel Abdallah al-Zayedi.

He said the elderly man was struck by bullets to the head fired by unknown gunmen in a car, in an apparent revenge attack for his work as a judge.

"The perpetrators were people with criminal records who had been sentenced by judge Lekhfifi," he said, noting that thousands of inmates had been set free during Libya's 2011 revolution.

A hospital source said the ex-judge appeared to have been shot by a sharpshooter and had died on the spot.

Cradle of the 2011 uprising that ousted long-time dictator Moamer Kadhafi, Benghazi has been rocked by a series of killings of soldiers and police who served under the former regime.

Libya's new authorities have struggled to re-establish order and form a professional police force and army since Kadhafi's overthrow, with former rebel fighters having formed powerful militias.