GAZA CITY, Palestinian Territories: A ceasefire announced by Hamas largely held on Sunday after the most severe exchange of fire between Israel and Palestinian militants in the Gaza Strip since a 2014 war, easing fears of a wider conflict for now.

Hamas, the Islamist movement that runs the blockaded Gaza Strip, said late on Saturday a ceasefire had been reached with the help of Egypt and others, though Israel declined to comment.

The United Nations’ Middle East envoy Nickolay Mladenov was in Gaza and "working with all concerned parties to de-escalate the situation," a UN official said on condition of anonymity. In a press conference, he called on "everybody to step back from the brink".

Despite a few lower-level exchanges of fire, relative calm returned to the Gaza Strip. In one incident on Sunday, an Israeli aircraft fired at what it said was militants launching balloons carrying firebombs over the Gaza border fence. It was not clear if there were casualties.

Saturday saw dozens of Israeli air strikes, killing two Palestinians, while some 200 rockets and mortars were fired from the enclave at Israel. Four Israelis were wounded when a rocket hit a house in the city of Sderot near the Gaza Strip, authorities said.

The two Palestinians killed were aged 15 and 16, caught in an Israeli strike on a building in Gaza City, the enclave’s health ministry said. Twenty-five people were wounded across Gaza, it said.

Hamas said it fired at Israel in defence in response to air strikes, which came after a soldier was wounded by a grenade along the Gaza border. Hamas leader Ismail Haniya said on Sunday at the funeral for the two teenagers that the movement would challenge Israel with border protests until the blockade is lifted.

"This blood will not be shed for nothing," he told hundreds of mourners. "The enemy will not escape the punishment of the heroic resistance." The mother of Amir al-Namra, the 15-year-old killed, said: "He just went out for walk. What did he and his friend do for them to be killed?"

Israel blamed Hamas for the escalation, pointing to months of protests and clashes along the border that its military argues the Islamist movement is seeking to use as cover for attacks. There have also been hundreds of fires at Israeli farms caused by kites and balloons carrying firebombs from Gaza, leading to political pressure on the government and military to take action against Hamas.

Israeli Prime Minister Benjamin Netanyahu said Hamas had been hit with "the hardest blow" since a 2014 war. He said Israel would not accept a ceasefire "that would allow the continuation of terrorism by incendiary kites and balloons".