Sami Anan was arrested following plans to compete against President el-Sisi in the March 2018 election.

Egypt‘s former military chief-of-staff Sami Anan has been released from detention almost two years after his arrest following his plans to compete in the 2018 presidential election, his office manager said on Twitter.

Anan, now at home according to the manager, Mustafa Elshall, was held in a military prison until he suffered a stroke in July 2018 and was then moved to a military hospital in Cairo’s Maadi suburb, where he remained until his release on Sunday.

His health has improved, a source familiar with the matter told Reuters news agency. The reason for his release is still unclear.

Anan, seen as President Abdel Fattah el-Sisi‘s main challenger in that election, was arrested and halted his presidential bid after the military accused him of running for office without permission, which it said was a breach of military law. Anan’s spokesman denied he broke any laws.

El-Sisi was re-elected for a second term in 2018, winning 97 percent of the vote with a 41 percent turnout. The election featured only one other candidate, an ardent el-Sisi supporter after opposition contenders halted their campaigns in January.