ISIS has been signaling its designs on the Palestinian territory of Gaza. "The rule of sharia will be imposed on Gaza," an ISIS fighter announced in a recent video.

And that means going after Hamas, the violent Islamist group that controls the Palestinian territory. Abu al-Ayna al-Ansari, a spokesman for Palestinian groups that have pledged to ISIS, told the New York Times, "We will stay like a thorn in the throat of Hamas, and a thorn in the throat of Israel."

ISIS's ultimate ambition appears to be toppling Hamas. That threat is backed up by force: up to 12 attacks targeting Hamas in Gaza this year, according to the Times, have come from militants pledging allegiance to the Islamic State.

This comes at a dangerous time for Gaza. Hamas was battered during the 2014 war with Israel. Having essentially failed as a governing body, they're pretty vulnerable. ISIS, with an affiliate nearby in Egypt, is well positioned to violently challenge Hamas for control of the Gaza strip.

ISIS has virtually no chance of truly toppling Hamas. And it's not clear whether it will try, but even the potential for such a conflict is bringing yet more tension and uncertainty to a place that has already suffered. They could cause a lot of pain to Gaza's residents — and provoke Israel in some dangerous ways.

Hamas is vulnerable — and ISIS can take advantage

It makes sense that ISIS-linked fighters would want to challenge Hamas in Gaza. Ideologically, ISIS sees itself as the only truly Islamic government in the world. Even al-Qaeda isn't hardline enough for them. All other groups must pledge allegiance to ISIS, or be destroyed. Hamas, as an alternative militant group, is an ideological threat.

ISIS doesn't have the muscle to go after literally everyone in the Muslim world. But they're in a stronger position than you might think in Gaza: both because of Hamas's problems and ISIS's rising strength.

Gazans increasingly see Hamas as a failure. A June poll from the Palestinian Center for Policy and Survey Research found that half of Gaza's residents were considering emigrating — "the highest percentage ever recorded in our polls." Hamas's past three wars with Israel have brought nothing but suffering to Gaza, and failed to break Israel's near-total restrictions on the flow of goods and people into the territory.

But Fatah, the corrupt and somewhat authoritarian party that controls the West Bank and the Palestinian Authority (PA), isn't very popular either. Palestinians do not really have good political choices. That creates an opening for ISIS; the murderous and widely reviled group is not going to be welcomed into Gaza with open arms, of course, but all it needs is enough angry and disaffected young men it can recruit.

Both "the secular nationalism" of Fatah and "the Islamist nationalism of [Hamas] have run aground," Hussein Ibish, Senior Resident Scholar at the Arab Gulf States Institute, explains. "So in come the anti-nationalists, who say 'no, no, that's all wrong. It's all about God, Umma, and the caliphate.'"

That is ISIS's opening: Palestinians, especially the younger generation, are fed up with their current leaders and looking for something new. "If they are good at mobilizing young Gazans," says Daveed Gartenstein-Ross, a senior fellow at the Foundation for the Defense of Democracies, "[Islamic State] as a youth movement could have an effect."

"The potential for ISIS to use Sinai as a launching pad into Gaza is very great"

On its own, this dissatisfaction wouldn't make ISIS into a major threat; it's doubtful that enough Palestinians would join. But there's another factor: ISIS's presence in the Sinai Peninsula, just to the west of the Gaza Strip.

Sinai is Egyptian territory, but it is barely governed in places, and is a haven for a lot of militant groups, including an ISIS affiliate called Wilayat Sinai (Sinai Province). Just Wednesday, Wilayat Sinai attacked Egyptian military positions in the area, killing dozens in a bid to take control of little bits of territory.

The danger for Gaza is twofold. ISIS could send some of its own operatives in from the Egyptian border, setting up a terrorist cell and stepping up recruiting. Or it could convince one of the many smaller radical group that Hamas allegedly permits to cross the border to pledge to ISIS — and eventually turn on Hamas.

"I think if Gaza didn't border Sinai, there'd be a virtually negligible threat from ISIS, Ibish says. But "the potential for ISIS to use Sinai as a launching pad into Gaza is very great."

ISIS's threats to Hamas are dangerous for Gaza — and for Israel

ISIS wouldn't be the first radical jihadi group in Gaza to challenge Hamas, all of which have failed. "The problem for the [jihadis] is Hamas has a strong security apparatus," Gartenstein-Ross says. Despite Hamas' political problems, they're still quite good at policing and repression. So ISIS faces, per Gartenstein-Ross, "the same barrier as past [jihadi] efforts in Gaza."

Both he and Ibish believe, for this reason, that ISIS has virtually no chance of actually toppling Hamas and turning Gaza into a western provence of the Islamic State. But that doesn't mean they can't make a lot of trouble.

"What ISIS can do in Gaza is what they've done in some other places: create chaos," Ibish says. "They can do damage to Palestinians and antagonize Israel."

The Gaza situation, then, is a good microcosm for ISIS in general

ISIS could also push Hamas into a more militant policy. Right now, Hamas's political leadership isn't really interested in open confrontation with Israel: the last war turned out badly. But its military wing is, in general, more aggressive — and its ideology and public message centers on its "resistance" effort against Israel. An ISIS challenge could force "Hamas to a more hardline position, either to compete or else out of expedience; they want a harder line view, and can use [ISIS]'s emergence as an excuse," Gartenstein-Ross says.

It is easy to imagine how this sort of situation could lead to another war between Gaza and Israel. A real ISIS presence in Gaza would be, from Israel's point of view, an unacceptable threat. Moreover, longstanding Israeli policy is to punish Hamas for any cross-border attacks from other militant groups: if Hamas isn't punished, the theory goes, then they have no reason to actually rein in the other groups. That is just one example of how such a situation could spiral out of control. Another is that ISIS might seek to deliberately provoke some kind of deadly Israeli response.

The Gaza situation, then, is a good microcosm for ISIS in general: though ISIS's quest to establish a caliphate around the Middle East is doomed to failure, it can do a hell of a lot of damage on its way down.