JERUSALEM (AP) — The Palestinian militant group Islamic Jihad said Thursday it had agreed to halt a wave of rocket fire on Israel, signaling an end to the heaviest fighting between the sides since 2012, though soon after the announcement two rockets fired from Gaza exploded inside Israel.
The Islamic Jihad denied it launched the attack and it wasn’t immediately unclear who fired the rockets. Cease-fire declarations have not always been honored by militants and the barrage raised doubts about the cease-fire offer made by Islamic Jihad.
The Israeli military said a total of four rockets were fired Thursday from Gaza. Israeli officials previously refused to confirm any cease-fire deal was in place.
In two days of violence, militants fired more than 60 rockets into Israel, while Israel has carried out a series of airstrikes in Gaza. No serious casualties have been reported.
Islamic Jihad leader Khaled al-Batch announced Thursday that his group had accepted an Egyptian-brokered plan to stop its attacks, if Israel agreed to a truce as well.
‘‘After the Egyptian brothers initiated contacts with us in the past few hours, we agreed to restore the calm,’’ said Khaled al-Batch, the group’s leader in Gaza. ‘‘As long as the occupation (Israel) honors the calm, we will honor the calm and instructions are being given right now to al-Quds brigades, our military wing, about this understanding.’’
A senior security official in Egypt, which has brokered similar truces in the past, said Egyptian intelligence officials had been in touch with the sides and brokered an agreement. The official spoke on condition of anonymity because he was not authorized to speak to journalists.
Earlier Thursday, the Iranian-backed Islamic Jihad resumed rocket fire toward Israel, striking the outskirts of two major cities. A day earlier, it fired dozens of rockets in the largest barrage on Israel since an eight-day Israeli offensive in late 2012.
The Israeli military said it retaliated with renewed airstrikes on ‘‘seven terror sites’’ in southern Gaza. In all, it said some 65 rockets had been fired into Israel over the past two days.
‘‘Since yesterday, there has seen a substantial deterioration in the safety of the residents in southern Israel. We have responded and will continue to do so in order to eliminate threats as they develop,’’ said Lt. Col. Peter Lerner, a military spokesman.
The early morning rocket attacks from Gaza set off air-raid sirens in the southern cities of Ashdod and Ashkelon. The rockets landed in open areas, but flew deeper into Israel than Wednesday’s attacks, which struck southern Israeli border towns.
Islamic Jihad said it resumed their rocket fire in response to what they say are Israeli violations of a cease-fire, including an airstrike that killed three Islamic Jihad militants earlier this week.
Until this week, both sides largely observed a cease-fire that ended the Israeli offensive against rocket launchers in November 2012.
At a meeting Thursday with the visiting British Prime Minister David Cameron, Israeli Prime Minister Benjamin Netanyahu vowed to step up the pressure on the militants. He was to meet with his Security Cabinet to discuss a further response, though expectations were that tensions would ease.
‘‘Our policy in the south is clear. We harm those who try to harm us and respond fiercely to any attack,’’ Netanyahu said. ‘‘The terrorist groups in Gaza need to understand that they are dealing with a very determined government and a very strong army.’’
Cameron has condemned the rocket fire.
Gaza’s ruling Hamas movement has not been involved in the latest fighting. But Israeli leaders say they hold the Islamic militant group responsible because it rules the coastal Palestinian territory.
Daoud Shihab, a spokesman for Islamic Jihad, said implied that Hamas had given at least tacit approval for the group’s activities, saying ‘‘the response of yesterday was blessed by all the factions.’’
Sami Abu Zuhri, a Hamas spokesman, said Israel ‘‘bears full responsibility’’ for the escalation.
Hamas has controlled Gaza since overrunning the forces of Palestinian President Mahmoud Abbas in 2007. Abbas now governs in the West Bank, located on the opposite side of Israel.
At a meeting Cameron in the West Bank town of Bethlehem, Abbas called for an end to the violence. ‘‘We condemn the aggression and all forms of military escalation, including the rockets,’’ he said.
Gaza militants have fired thousands of rockets and mortar rounds at Israel over the past decade. Attacks have significantly declined since the 2012 offensive, though Israeli aircraft periodically strike militants who launch rockets.
Associated Press writer Ashraf Sweilam in Sharm El-Sheikh, Egypt, contributed to this report.