Turkey Erdogan PM Court
Wives and relatives of retired and active military officers charged in the so-called Sledgehammer trial hold a protest at Anitkabir, the mausoleum of Mustafa Kemal Ataturk, founder of secular Turkey, in Ankara.Reuters

A Turkish court has ordered the release of 230 military officers convicted of a plot to overthrow the Turkish Prime Minister Recep Tayyip Erdogan in 2003.

The decision came after the country's top court ruled that the military officers' trial was flawed and Erdogan supported a retrial in January after his advisers said that the officers had been framed.

Celal Ulgen, defending some of the officers, earlier said: "If the constitutional court ruling arrives during the day, the releases may begin."

The Sledgehammer trial took place between 2010 and 2012 and saw Erdogan attempt to quash a military which had exerted influence over Turkish politics for decades.

The plot came just months after Erdogan was appointed prime minister and included alleged plans to bomb mosques as well as the provocation of war with Greece by shooting down a Turkish aircraft.

The Sledgehammer trial, among others, had led to accusations that the Erdogan administration was using the Turkish justice system to silence political opponents.

Last week, Kenan Evren, a 96-year-old former army chief, was sentenced to life in prison for his involvement in a 1980 coup which led to widespread unrest.