Mohammed Mahdi Akef, a former leader of Egypt’s outlawed Muslim Brotherhood who had been detained since 2013, died on Friday in Cairo. He was 89.

Talaat Fahmy, a Brotherhood spokesman, said the cause was complications of cancer and other health issues. He said that Mr. Akef’s family had requested that he be released from custody because of his health, but that the request was declined by an Egyptian court.

Mr. Akef, who headed the Muslim Brotherhood from 2004 to 2010, was among hundreds of members arrested after the Egyptian military’s 2013 ouster of President Mohammed Morsi, a member of the Brotherhood.

Mr. Akef was initially convicted on charges of inciting violence and disturbing general security and was sentenced to life imprisonment. The verdict was overturned on appeal, and he was facing a retrial.