The Israeli military said it struck in the Gaza Strip early Thursday morning, targeting Hamas military posts in the coastal enclave in retaliation for a rocket that was launched at Israel's south earlier on Wednesday, while Prime Minister Benjamin Netanyahu was attending an election campaign event there.

Netanyahu, who had been making an address at a gathering in the port city of Ashkelon, was rushed off the stage with his wife Sara to a nearby shelter; he later returned to complete his speech.

Meanwhile, the Israeli military confirmed that the Iron Dome missile defense system intercepted one rocket fired from the Strip.

The Mossad, China's Trojan horse, censorship and state secrets on our podcast. Listen 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

The Israeli army said in a statement Thursday that "combat jets and helicopters struck several terror targets belonging to the Hamas terror organization in the Gaza Strip, including military compounds."

The army added that the strike was carried out in response to the rocket that was launched at Israel Wednesday evening.

"The Hamas terror organization is responsible for everything that happens in the Gaza Strip, and it will be held accountable for its actions against Israel's citizens," the IDF Spokesperson's Unit stated.

>> Read more: Cool Tel Avivian or pro-settler nationalist? Netanyahu could be ousted by this man ■ Netanyahu-Sa'ar showdown pits tribal loyalty vs. rational expediency | Analysis

During his speech at the Ashkelon event, the premier – who is facing a tense race for the Likud party leadership beginning Thursday – referred to the Israeli military's assassination of senior Islamic Jihad commander Baha Abu al-Ata in the Strip last month. Al-Ata's killing triggered a short-lived but tense round of fire between Israel and the Gaza group.

"He who fired [rockets] last time isn't with us anymore," Netanyahu said. "And he who fired now, better start packing his belongings," the prime minister continued, seemingly implying that whoever is behind the rocket fire this time will be targeted and retaliated against in a similar way.

"This isn't an attack on me or on Ashkelon, it's not that. These are recurring attacks on our communities, and they think that we won't hurt them or that we'll break down," he added.

The event Netanyahu spoke at was documented and videos of it were live streamed on several websites of Israeli local newspapers in the south, inadvertently revealing the premier's exact location.

Earlier Wednesday, alarms warning of incoming rockets had sounded in Ashkelon, the Be'er Tuvia Regional Council and the Hof Ashkelon community.

Ahead of Israel's election this year in September, two rockets were launched at the southern Israeli city of Ashdod while the prime minister addressed crowds at a campaign event. Netanyahu was rushed off the stage at the time, as the rockets were intercepted by the Iron Dome missile defense system. In that incident, too, Netanyahu later came back to finish his speech.

Following the incident, the premier held an emergency consultation with the chiefs of the Israeli security establishment at army headquarters in Tel Aviv, and had planned to carry out rare military action in Gaza.

He halted the move after Attorney General Avichai Mendelblit told him that he believes such a decision has to be approved by the security cabinet, which Netanyahu failed to consult with. Netanyahu's bureau had not released details from the emergency meeting, but several hours later the Israel Air Force struck Hamas military targets in Gaza.