Mohamed Morsi, who was 67, had been in custody since he was ousted by the military in 2013 after mass protests.