One of the top members of the Egyptian Muslim Brotherhood and the leader of the Freedom and Justice Party ruled the country between June 2012 and July 2013.

Mohamed Morsi has died after he fainted during a trial and was taken to the hospital on 17 June, Egyptian Al-Ahram Gate reported. The incident happened during the adjournment of the court session, when Morsi reportedly suffered a heart attack.

"He was speaking before the judge for 20 minutes then became very animated and fainted. He was quickly rushed to the hospital where he later died", one of the sources in court told the AFP.

Another anonymous official has shared with the AP that during his speech prior to fainting, Morsi claimed that he had "many secrets" that could get him out of prison, but which he couldn’t reveal as it would allegedly harm the country's national security.

Turkish President Recep Tayyip Erdogan paid tribute to “martyr” Morsi upon receiving news of the former Egyptian president's death, with whom he established good relations and whose ouster he harshly condemned.

"May Allah rest our Morsi brother, our martyr's soul in peace", Erdogan said.

The criminal court was reviewing espionage charges against Morsi and 23 other Muslim Brotherhood members, when the former Egyptian president collapsed.

Morsi won the 2012 presidential elections and was sworn in on 30 June the same year, but his presidency lasted just over a year as he was deposed after numerous marches of multimillions of protesters across the country in June 2013. Despite his refusal to accept the Egyptian Army’s 48-hour ultimatum to meet the public’s demands, then Minister of Defence Abdel Fattah el-Sisi announced Morsi’s removal from office.

© AP Photo / Amr Nabil Former Egyptian President Mohammed Morsi, wearing a red jumpsuit that designates he has been sentenced to death, raises his hands inside a defendants cage in a makeshift courtroom at the national police academy, in an eastern suburb of Cairo, Egypt, Saturday, June 18, 2016

Morsi came to power following the 2011 uprising that saw long-serving President Hosni Mubarak removed from office. However, Morsi, failed to cope with the challenge of a collapsing economy, with his presidency being riddled with massive protesters, some of which turned deadly.