AT DAWN earlier this month three men were led to the gallows in Gaza, the first executions for nearly a year. Hamas, the Islamist group that controls the strip, had earlier offered clemency to Palestinians who collaborate with Israel—promising that the “doors of repentance” would be open if they confessed. That was the carrot. The hangings were the stick.

These are tense times in Gaza, after the assassination on March 24th of Mazen Fuqaha, one of Hamas’ military commanders. A native of the West Bank, he was arrested in 2002 for his role in a suicide bombing in Israel, then freed in a prisoner swap in 2011 in return for a captured Israeli soldier, Gilad Shalit. He died in his garage after an afternoon outing with his family, shot four times with a silenced pistol. It was a professional job. The gunmen collected their shell casings and disabled a nearby security camera. Hamas was quick to blame Israel.

The men hanged as collaborators with Israel probably had nothing to do with it: all three were arrested long before Mr Fuqaha’s death. But their hasty executions, after years languishing in prison, were a sign of how badly the hit had rattled Hamas. The group imposed a partial closure at Erez, the sole pedestrian crossing with Israel. It was meant to stop accomplices from fleeing; but it also blocked sick Palestinians from travelling for medical treatment. Fishermen were barred from going out on the water, hurting an industry that supports thousands of Gazan families.

All of this comes at a difficult time. Hamas is in the middle of its first leadership change in more than a decade, with its veteran head, Khaled Meshal, expected to step down later this year. After four ruinous wars against Israel, there are signs that it wants a policy change as well. The group is debating a major revision of its founding charter of 1988. Some in the politburo want Hamas to accept a Palestinian state along the pre-1967 borders—implicitly acknowledging Israel’s existence—and dump the worst anti-Semitic language from the original. Others appear wedded to confrontation with the Jewish state.

No one expects a handshake with Binyamin Netanyahu. But Israeli officials think the changes are a sign that part of the political wing is open to a long-term truce that would avoid another conflict. “What interests me is not what they’re doing, but the fact that they feel the need to do it,” says one intelligence official.

Hamas has also begun to mend its strained relationship with Egypt, which has long accused the group of aiding Islamist militants in Sinai. Cairo imposed a military blockade on the strip after Hamas seized power there in 2007: Rafah, the sole border crossing accessible to most Gazans, was open for just 48 days last year. But in February Egypt opened it to commercial traffic, allowing trucks to cross for the first time. This came after Hamas promised to stop treating wounded jihadists in Gaza.

Yet Hamas’s military wing depends on smuggling tunnels controlled by the same jihadists to replenish its arsenal. In the wake of Mr Fuqaha’s assassination, they have begun rattling the sabre at Israel. Billboards with his likeness have gone up around the strip: “Challenge accepted,” reads one, in Arabic and Hebrew. The group also released a video threatening to kill senior Israeli army officials. For now, their only retaliation has been against other Palestinians. But the uneasy ceasefire that ended the last war is looking fragile.