DEIR AL-BALAH, Gaza Strip — One bomb hit a Hamas security checkpoint in northern Gaza. A few days later, another exploded in a trash can. Another blew up next to a Gaza City high-rise, and a small one targeted a chicken store owned by a Hamas intelligence official, Saber Siyam.

The four attacks in May — among at least a dozen this year, documented by a local human rights group — were aimed not at infidels, collaborators or criminals but at the ruling Islamist group, Hamas. The suspected perpetrators were Hamas’s emerging rivals: extremist Islamist groups that see Hamas as insufficiently pious, and that vow loyalty to the Islamic State.

While the extremists are unlikely to challenge Hamas’s firm grip on the Gaza Strip in the foreseeable future, they complicate matters by occasionally shooting rockets into Israel that could touch off a wider conflagration, if the rockets kill or maim Israeli citizens.

They could also seek to join forces with the far more dangerous, deadly branch of the Islamic State in neighboring Egypt’s Sinai Desert, possibly derailing the slowly improving relations between Hamas and Egyptian authorities that have recently led to the Egypt-Gaza border crossing’s being opened for brief moments for the first time in years.