Egypt's former President Mohamed Morsi, who was ousted by the army in 2013, has died after fainting in a courtroom, state TV says.
A former top figure in the now-banned Islamist movement Muslim Brotherhood, Mr Morsi was in court for a hearing on charges of espionage. He was 67.
He was overthrown following mass protests a year after he took office as the country's first democratically elected leader and had remained in custody since then.
After his removal from power, Egyptian authorities launched a crackdown on his supporters and the Muslim Brotherhood.
The hearing in Cairo was related to charges of espionage emanating from suspected contacts with the Palestinian Islamist group Hamas, according to state television.
The former president was born in the village of El-Adwah in the Nile Delta province of Sharqiya in 1951. He studied Engineering at Cairo University in the 1970s before moving to the US to complete a PhD.
He was chosen as the Muslim Brotherhood's presidential candidate for the 2012 election after the movement's preferred choice was forced to pull out. After a narrow victory, he promised to head a government "for all Egyptians".
But critics complained he had failed to deliver during his turbulent year in office. They accused him of allowing Islamists to monopolise the political scene and mishandling the economy.
Public opposition to his government grew and millions of anti-government protesters took to the streets across Egypt to mark the first anniversary of the day he took office, on 30 June 2013.
On the evening of 3 July, the army suspended the constitution and announced the formation of a technocratic interim government ahead of new presidential elections. Mr Morsi, who denounced the announcement as a coup, was taken into custody by the army.