Prime Minister Benjamin Netanyahu said on Thursday that Israel would probably have no choice but to go to war in the Gaza Strip.

Speaking in an interview with Reseht Bet Radio, the premier said that Israel would likely have to set out on a campaign in the coastal enclave in light of the ongoing escalation in recent months.

Haaretz Weekly Ep. 39 0:00 -- : -- 15 Skip 15 seconds backwards Play audio 15 Skip 15 seconds ahead 1 X Change playback rate from 1 to 1 Mute audio

>> Read more: Hamas official says not behind rockets at Israel, but launches show change is needed in Gaza ■ While Netanyahu makes annexation promises, reality (almost) hits him on the head | Analysis

However, Netanyahu clarified that "a dangerous war is the last resort," adding that he wouldn't send Israeli troops to the Strip in order to halt rocket fire emanating from there "until we get optimal conditions [to do so]."

The prime minister accused Hamas of failing to enact its sovereignty in Gaza and control other groups, like Islamic Jihad, that have staged attacks on Israel. "There is a terrorist element that wants to destroy us," he said.

"We have a basic situation of a terror group that has taken over and launches rockets, that doesn't control errant factions even when it wants to. Hamas understand where they are headed, but can't stop. Because they can't, there will be no choice but to enter a war."

Netanyahu also hinted that Israel may carry out several military steps before setting out on a military operation.

Speaking about a potential reconciliation between the U.S. and Iran, Netanyahu said that he doesn't think Israel would be left on its own. "I've always said that if we need to act alone we will, but I don't think we are [alone]."

Netanyahu said Israel is a party to any consultations, and that Israel and the U.S. are working to curtail Iran on different fronts. "If anyone is concerned over the Iranian aspirations … the question to ask is who would lead that, I or Benny Gantz and [Yair] Lapid, and who would be in charge of negotiations – both on this issue and regarding the Deal of the Century."

The prime minister also referred to his public dispute at the Knesset with Joint List Chairman Ayman Odeh, who sparred with him ahead of the vote over a Likud-sponsored bill to place cameras at polling stations, which failed to pass.

Odeh called Netanyahu a liar, pretended to film him with a smartphone in a polemical reference to the camera law, and the two entered a rare scuffle. On Thursday morning, Netanyahu said that he "doesn't tend to agree with Odeh."

The prime minister went on to address a report Wednesday that his official Facebook page activated a chatbot urging users to convince unpersuaded voters to cast their ballot for Likud, and warning that "Arabs want to destroy us all – women, children and men."

Netanyahu denied writing the message that had targeted potential voters. "I didn't write this, it was a mistake of one of the staffers. Think clearly: Would I really write anything like this? I'm a serious person with acquaintances in Arab countries. No leader had such relations with the Arab world and Arab leaders."

He proceeded to go after Haaretz, which was the first publication to report the election message by his official social media handle. "What are you, Haaretz?" he said.

On Wednesday, ahead of Netanyahu's statement about war in Gaza, the Israeli army struck a Hamas military compound in the Strip in response to rockets fired from the coastal enclave. Three rockets were fired at Israel earlier in the day, also triggering retaliatory fire against two Hamas military positions by an Israeli army tank.

A day earlier, rockets were launched from the Gaza Strip toward the Israeli cities of Ashkelon and Ashdod while Netanyahu was addressing crowds at a campaign rally in the latter city, and had to be taken off the stage mid-speech. In response, the Israel Defense Forces struck some 15 Hamas targets in the northern and central Gaza Strip overnight Tuesday.