By Thierry Lévêque

PARIS (Reuters) - France's highest court has ordered a retrial of police officers who were cleared of blame in the deaths of two teenagers seven years ago that triggered nationwide rioting.

In a ruling that averts possible tension in the grim suburbs ringing many French cities, the court ordered a retrial to fully assess accusations that police failed to rescue two teenagers who fled inside an electrical substation and were electrocuted.

The deaths in the night of October 27, 2005, sparked clashes between angry youths and riot police in the downtrodden suburb of Clichy-sous-Bois north of Paris.

In the following three weeks rioters in cities across the country burned thousands of cars, damaged buildings and opened fire at times in running battles with police.

The unrest, which forced the government of President Jacques Chirac to impose emergency curfew measures, occurred mostly in the immigrant-heavy social housing estates on city fringes where poverty, joblessness and social alienation are rife.

In Wednesday's ruling, the Cour de Cassation overturned an April 2011 ruling in which two police officers in Clichy-sous-Bois were cleared of failing to rescue the two teenagers.

One was a trainee on a police switchboard on the night of the event and the other a beat officer who was accused of leaving the vicinity of the substation without raising an alert.

An internal police inquiry showed the two youths who died had committed no offence although they fled from police who suspected them of involvement in a nearby break-in.

(Writing by Brian Love; editing by Andrew Roche)