Egypt’s military detained a retired general for questioning on Tuesday, announcing an investigation into his bid to challenge President Abdel Fattah el-Sisi in an election scheduled for March.

In a rare audio statement, the military said it was taking “necessary legal action” against the retired general, Sami Anan, who announced his candidacy on Saturday. The statement accused Mr. Anan, who was the chief of the general staff of Egypt’s armed forces between 2005 and 2012, of “violations and crimes” including document forgery and “incitement against the armed forces.”

Mr. Anan was detained as he drove through the Nasr City neighborhood of Cairo, his son Samir said by telephone. “They forced him out of his car, led him into a van and left,” Samir said.

The elder Mr. Anan, 69, was not considered a strong challenger to Mr. Sisi, a former general who has ruled Egypt with an iron grip since 2014, when he was elected with 97 percent of the vote. But his detention does suggest how far Mr. Sisi is willing to go to clear the field of challengers — even if doing so means crossing senior figures inside the military establishment that is his political bedrock.