“It is inconceivable that the thinking that we hold most sacred should cause the entire Islamic world to be a source of anxiety, danger, killing and destruction for the rest of the world,” Mr. Sisi warned.

But Mr. Behery’s ideas offended the scholars at Al Azhar, who accused him of “violating the foundations of Islam” and, with others, brought a slew of court cases against him. One of those cases resulted in a criminal prosecution, and on Dec. 28 Mr. Behery began serving a one-year sentence.

“Egypt is the country of injustice,” Mr. Behery wrote in a Facebook post before he was imprisoned.

The prosecution appeared to signal the limits of Mr. Sisi’s approach to modernizing Islam. Al Azhar, which is state-funded, has hewed closely to Egypt’s rulers for the past six decades, yet at the same time jealously defended its position as Egypt’s premier authority on Islam.

Some clerics appeared to take Mr. Sisi’s speech last year as an attack on the integrity of Al Azhar itself, said Nathan J. Brown, a professor of political science and international affairs at George Washington University who specializes in the Middle East.

“For people within Al Azhar, there was something remarkable and distasteful about a president and a general lecturing them about religion,” he said. “You saw some pushback, in the form of a proxy struggle. Then there was the episode with Islam Behery.”

Still, the relationship between the different arms of the Egyptian state is notoriously hard to read, and some experts see the court prosecution as an example of Al Azhar flexing its institutional muscle. In public, Al Azhar has always been loudly supportive of Mr. Sisi.

Shortly after the takeover, the grand imam of Al Azhar, Sheikh Ahmed al-Tayeb, sat by the general’s side at his inaugural news conference.