FILE PHOTO - Egypt's Chief of Staff of the Armed Forces Sami Anan during a meeting in Cairo, Egypt March 29, 2011. REUTERS/Khaled Desouki/Pool/File Photo

CAIRO (Reuters) - Egypt’s former military chief-of-staff Sami Anan was released from detention on Sunday 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, 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.

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

Anan, seen as 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 that he had broken any laws.

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