Mohamed Morsi, a senior member in the Egyptian Muslim Brotherhood, came out of comparative obscurity when he was named Egypt’s first democratically elected president, in an election held in the messy aftermath of the 2011 revolution.

He died asking to speak in a soundproof cage in a courtroom just seven years later.

His legacy will be a complex and sad one.

Morsi wasn’t even the Brotherhood’s first choice as their presidential candidate in 2012.

Khairat al-Shater, the leader believed to be the true political and financial power behind the group’s throne, had been disqualified on the grounds that he had been released from prison the year before.

Morsi meanwhile, an engineer and university professor, was short, unimposing, and teased for having little charisma.

He was even lumbered with the nickname “spare tyre” in Arabic.

In pictures: Egypt protests on Arab Spring anniversary Show all 11 1 /11 In pictures: Egypt protests on Arab Spring anniversary In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests A supporter of Egyptian President Abdel Fattah al-Sisi waves his national flag during a demonstration in Cairo on January 25, 2015 AFP In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests A riot police officer holds a weapon during an anti-government protest in downtown Cairo January 25, 2015 Reuters In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests An anti-government shouts slogans against the military and interior ministry during a protest in front of the journalists' syndicate in Cairo January 25, 2015 Reuters In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests Anti-government protesters shout as they call out to others with them to walk into Tahrir square after they clashed briefly with pro-government protesters, in Cairo January 25, 2015 Reuters In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests Anti-government protesters help an injured protester when pro-government protesters threw stones during a protest in front of the press syndicate in Cairo January 25, 2015 Reuters In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests An Egyptian is arrested by plainclothes police in downtown Cairo, Egypt, Sunday, Jan. 25, 2015 AP In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests Egyptian security forces deploy in the Cairo suburb of Matariyah, Egypt, Sunday, Jan. 25, 2015 AP In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests A woman mourns during the funeral of Shaima al-Sabbagh, Alexandria, Egypt, 25 January 2015 EPA In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests Two supports of ousted President Mohamed Morsi in front of security forces near Tahrir Square in Cairo (AFP) In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests Egyptian policemen detain a supporter of the People's Alliance Party during a demonstration in Cairo's Talaat Harb square, near Tahrir square, on January 24, 2015 (AFP) In pictures: Egypt protests on Arab Spring anniversary Cairo anniversary protests People carry the coffin of Shaima al-Sabbagh during her funeral, Alexandria, Egypt, 25 January 2015 EPA

At the beginning, as the country’s establishment was rocked by the millions of Egyptians demonstrating in the 2011 Arab Spring protests, the Brotherhood remained on the sidelines and resisted joining.

Sensing they were at a turning point in the country’s history the group joined during the 18 days – a key tipping point in Egypt’s revolution, with their support instrumental in forcing Hosni Mubarak to step down.

But in the months after Mubarak’s resignation was announced, the group ordered their members to leave Tahrir Square, even as the largely secular protesters continued various sit-ins – igniting distrust between 25 January revolutionaries and the Islamist group.

Some even accused the Brotherhood of doing deals with the military in the aftermath of the revolution, during bloody street battles between protesters and the security forces.

Yet the nation held its breath the day the presidential results were announced in early June 2012, as Morsi was propelled to the position of Egyptian president.

He had been competing against Mubarak’s last prime minister Ahmed Shafik – a man who had been labelled “feloul”, or remnant, of the last and hated regime.

For many Egyptians, anything was better than the Mubarak regime they had just ousted – even some secular revolutionaries had rooted for Morsi in the elections.

But he wasn’t a particularly popular or effective president.

Economically, the country did not recover much in the one year he was in office, instead Egypt was blighted by power cuts.

Politically it was fraught.

His first move in office as to push through changes to the country’s constitutional declaration placing himself above judicial oversight, banning challenges to his decree, laws and decisions.

Opposition figure Mohamed El Baradei at the time dubbed him a “new pharaoh”.

He appointed a then little-known member of the Supreme Council of the Armed Forces to be his defence minister – Abdel Fattah al-Sisi.

Mr Sisi would later oust him and take the presidency himself.

At the time, ironically, Mr Sisi’s appointment was seen to be the Muslim Brotherhood wrestling power from the military who had been in charge since the removal of Mubarak.

The new constitution Morsi oversaw was drafted by a constituent assembly dominated by conservative Islamist figures including Salafi groups, sparking fears among secular and Christian communities within the country.

Among the discussions, which did not lead to any concrete articles but still prompted serious concerns, were suggestions the marital age be lowered.

It was passed in December 2013 with 64 per cent of the votes, but opposition called for an investigation into results saying the polls were fraudulent.

A seemingly spontaneous protest group – under the name Tamarod or “rebellion” – was gathering force at this point.

Its members claimed to have collected over 20 million signatures calling for Morsi to step down.

On the streets of Cairo, it was common to see people with photocopied sheets of their demands that citizens could sign.

It was an act of defiance that at first seemed to sum up the national frustration with the Muslim Brotherhood, but quickly became too brazen to seem completely civilian led.

The 30 June 2013 protests they called were huge – tens of thousands of people amassed in Tahrir and other squares.

But among the crowds were members of the security forces, waving red football cards and shouting “Erhal” or leave. Someone had green lighted this.

Morsi was defiant. In a panicked speech, delivered during the 48-hour ultimatum the military gave him to resign and after the Brotherhood’s Cairo headquarters had been ransacked, he shouted that he was the “legitimate” leader of Egypt dozens of time.

On the 3 July he was ousted – then he disappeared. He would not be seen again until November of that year and then only in court.

He had been held, likely illegally, in different security buildings with almost no access to the outside world.

The first court session was similarly chaotic.

Morsi’s screams that “this was not a court – this was a coup” were drowned out by chants of lawyers and journalists calling for his blood.

The courtroom descended into violence when his defence team were battered by furious plaintiff lawyers shouting “execution, god willing”.

He would face a bewildering number of trials. He was first tried on charges of incitement to kill protesters during clashes outside Cairo’s presidential palace in December 2012.

He would then face trial for allegedly breaking free from jail in 2011, which he would be sentenced to death for in 2015. He would also be tried for espionage, the court hearing that was taking place the day he died.

A year before his death, British lawyers and parliamentarians including Crispin Blunt, off the back of an independent report commissioned by his family, warned that he may die in prison because he was so poorly treated.

He had diabetes, hypertension and liver disease, he was held for long stretches in solitary confinement. He was denied a proper diet, sometimes medication was withheld.