An Egyptian security official says the country's former grand mufti has survived a shooting south of Cairo shortly before entering a mosque to lead Friday prayers.

Captain Ahmed Alaa told The Associated Press on Friday that two masked gunmen shot at Ali Gomaa as he was walking toward the Fadel mosque in the Sixth of October district south of Cairo.

He said no one was wounded in the attack and the two men fled the scene. Egypt's CBC TV network says that one of Gomaa's body guards was slightly wounded.

Gomaa was one of the leading supporters of the military's ouster of Islamist President Mohammed Morsi in 2013.