Sometime in the near future, Mohamed Morsi, Egypt’s first democratically elected president, could be hanged to death by the state. That would be a profound injustice, considering the sham trial that landed him on death row.

But there is a more compelling reason to spare him. Egypt’s relentless and sweeping crackdown on Islamists, under the baseless contention that they are inherently dangerous, is becoming a self-fulfilling prophecy. Executing Mr. Morsi, who was sentenced on Saturday, would turn an underwhelming former statesman into a martyr. It also would send an unfortunate and needless signal to Egyptians who have historically been averse to militancy that taking up arms might be the only way to be heard.

A surge in terrorist attacks during the past two years, including recent ones targeting judges, suggests that armed violence is increasingly becoming an acceptable response. Shortly after Mr. Morsi’s sentence was imposed on Saturday, three judges were shot to death in Sinai. Earlier this month, a judge survived a bombing outside his house in a Cairo suburb.

Mr. Morsi was sentenced to death, along with more than 100 co-defendants, after being convicted of playing a role in a huge jailbreak during the nation’s popular uprising in January 2011. At the time, he was a midlevel leader of the Muslim Brotherhood, an Islamist movement that renounced violence in the 1970s and became the dominant political force after the revolt. He was among the scores of Muslim Brotherhood members who broke free from jail after being unfairly detained in the early days of the revolution.