Former Egyptian President Mohammad Morsi, who was ousted in 2013 by the military, died Monday after fainting in a courtroom. 

Egyptian state TV said Morsi died before he could be taken to the hospital. In a Facebook post, Morsi's son Ahmed confirmed the death of his father. "We shall unite with God, my father," he wrote.  

Morsi, 67, was the first democratically elected president in Egyptian history, having won the 2012 presidential elections as a member of the Muslim Brotherhood-affiliated Freedom and Justice party. The elections came after Egyptians ousted dictator Hosni Mubarak during the so-called Arab Spring in 2011. 

A military coup ousted Morsi in 2013, resulting in him being thrown in Cairo's Tora prison. The coup was launched due to demonstrations against Morsi led by protestors who believed that he sought unlimited powers and was trying to impose conservative Islam on Egypt. Morsi denied these allegations. 

The new military government was ruled by General Abdel Fattah el-Sissi, who sought to purge members of the Muslim Brotherhood, who supported Morsi.

Sarah Leah Whitson, the executive director of Human Rights Watch's Middle East and North Africa division, said that "inhuman imprisonment" and "deprivation of family visits and medical care" were the main reasons behind Morsi's poor health. She points at the Egyptian government as being responsible for his death, saying it was "critical negligence."

"I offer my deepest condolences to his family and the Egyptian people," Qatari Emir Sheikh Tamim bin Hamad al-Thani, a leader sympathetic to Morsi said. He then added a traditional Islamic phrase to mourn those who recently died, which is translated as "We belong to God and to him we shall return." 

Qatar-based al-Jazeera was blocked in Egypt, due to allegations that the media outlet is biased towards Morsi.

Turkish President Recep Tayyep Erdogan, another ally of Morsi, called him a "martyr" and a "brother." The Turkish leader said he hopes Morsi's soul rests in peace. 

In April, Egyptians voted in a referendum for el-Sissi to have expanded powers that could keep him as president until 2030.