After the resignation of Hosni Mubarak presidential powers were transferred to the Supreme Council of the Armed Forces, who relinquished power on 30 June 2012 when Islamist candidate Mohamed Morsi became the first democratically elected head of state in Egyptian history. He was ousted in a revolution and military coup a year afterward, jailed by the government, sentenced to death (later overturned), and died in prison six years later largely due to and medical mistreatment by the government.