* Truce begins after last-minute flurry of fighting
* Netanyahu hints at “severe” action if ceasefire fails
* Clinton praises Egypt’s Mursi for mediation efforts
* Eight-day conflict killed 162 Palestinians, 5 Israelis
By Marwa Awad and Nidal al-Mughrabi
CAIRO/GAZA, Nov 21 (Reuters) - Israel and the Islamist Hamas movement ruling the Gaza Strip agreed on Wednesday to an Egyptian-sponsored ceasefire to halt an eight-day conflict that killed 162 Palestinians and five Israelis.
Both sides fought right up to 9 p.m (1900 GMT) when hostilities were due to stop, with several explosions shaking Gaza City and rockets hitting the Israeli city of Beersheba.
Even after the deadline passed, a dozen rockets from Gaza landed in Israel, all in open areas, a police spokesman said.
If it holds, the truce will give 1.7 million Gazans respite from days of ferocious air strikes and halt rocket salvoes from militants that unnerved a million people in southern Israel and reached Tel Aviv and Jerusalem for the first time.
“Allahu akbar, (God is greatest), dear people of Gaza you won,” blared mosque loudspeakers in the enclave as the truce took effect. “You have broken the arrogance of the Jews.”
Fifteen minutes later, wild celebratory gunfire echoed across the darkened streets of Gaza, which gradually filled with crowds waving Palestinian flags. Ululating women leaned out of windows and fireworks lit up the sky.
Hamas leaders welcomed the agreement, calling it a triumph for armed resistance, and thanking Egypt for its role.
Some Israelis staged protests against the deal, notably in the southern town of Kiryat Malachi, where three Israelis were killed by a Gaza rocket during the conflict, army radio said.
Announcing the agreement in Cairo, Egyptian Foreign Minister Mohamed Kamel Amr said mediation had “resulted in understandings to cease fire, restore calm and halt the bloodshed”.
U.S. Secretary of State Hillary Clinton, standing beside Amr, thanked Egypt’s Islamist President Mohamed Mursi for peace efforts that showed “responsibility, leadership” in the region.
The Gaza conflict erupted in a Middle East already shaken by last year’s Arab uprisings that toppled several veteran U.S.-backed leaders, including Egypt’s Hosni Mubarak, and by a civil war in Syria, where Bashar al-Assad is fighting for survival.
Israeli Prime Minister Benjamin Netanyahu said he had agreed to “exhaust this opportunity for an extended truce”, but told his people a tougher approach might be required in the future.
“I know there are citizens expecting a more severe military action, and perhaps we shall need to do so,” he said.
The Israeli leader, who faces a parliamentary election in January, delivered a similar message earlier in a telephone call with U.S. President Barack Obama, his office said.
Obama in turn reiterated his country’s commitment to Israel’s security and promised to seek funds for a joint missile defence programme, the White House said.
Hamas leaders taunted Israel, with the movement’s exiled chief Khaled Meshaal saying in Cairo that the Jewish state had failed in its military “adventure”. But he pledged to uphold the truce if the Israelis complied with it.
Ismail Haniyeh, Hamas’s chief in Gaza and its prime minister there, said: “We are satisfied and proud of this agreement and at the steadfastness of our people and their resistance.”
According to a text of the agreement seen by Reuters, both sides should halt all hostilities, with Israel desisting from incursions and targeting of individuals, while all Palestinian factions should cease rocket fire and cross-border attacks.
The deal also provides for easing Israeli restrictions on Gaza’s residents, who live in what British Prime Minister David Cameron has called an “open prison”.
The text said procedures for implementing this would be “dealt with after 24 hours from the start of the ceasefire”.
Israeli sources said Israel would not lift a blockade of the enclave it enforced after Hamas, which rejects the Jewish state’s right to exist, won a Palestinian election in 2006.
The ceasefire was forged despite a bus bomb explosion that wounded 15 Israelis in Tel Aviv earlier in the day and despite more Israeli air strikes that killed 10 Gazans.
The Tel Aviv blast, near the Israeli Defence Ministry, touched off celebratory gunfire from militants in Gaza and had threatened to complicate truce efforts. It was the first serious bombing in Israel’s commercial capital since 2006.
In Gaza, Israeli warplanes struck more than 100 targets, including a cluster of Hamas government buildings. Medical officials said a two-year-old boy was among the dead.
Israel has carried out more than 1,500 strikes since the offensive began with the killing of a top Hamas commander and with the declared aim of deterring Hamas from launching rocket attacks that have long disrupted life in southern Israeli towns.
Gaza medical officials said 162 Palestinians, more than half of them civilians, including 37 children and 11 women, were killed in Israel’s assault. Nearly 1,400 rockets were fired into Israel, killing four civilians and a soldier, the military said.
Egypt, an important U.S. ally now under Islamist leadership, took centre stage in diplomacy to halt the bloodshed, using its privileged ability to speak directly to both sides.
Israel, the United States and the European Union designate Hamas as a terrorist organisation. It seized the Gaza Strip from the Western-backed Palestinian President Mahmoud Abbas in 2007 in a brief but bloody war with his Fatah movement.
“This is a critical moment for the region,” Clinton said. “Egypt’s new government is assuming the responsibility and leadership that has long made this country a cornerstone for regional stability and peace.”
She also promised to work with partners in the region “to consolidate this progress, improve conditions for the people of Gaza, provide security for the people of Israel”.
Egypt has walked a fine line between its sympathies for Hamas, an offshoot of the Muslim Brotherhood to which Mursi belongs, and its need to preserve its 1979 peace treaty with Israel and its ties with Washington, its main aid donor.
“Egypt calls on all to monitor the implementation of what has been agreed under Egypt’s sponsorship and to guarantee the commitment of all the parties to what has been agreed,” its foreign minister said at the news conference in Cairo.
Israel, the top recipient of U.S. assistance, agreed to stop fighting after having gathered troops and armour on the border with Gaza in preparation for a high-risk ground assault.
In Amman, U.N. chief Ban Ki-moon urged both sides to stick to their ceasefire pledges. “There may be challenges implementing this agreement,” he said, urging “maximum restraint”.
Israel withdrew unilaterally from the Gaza Strip in 2005, but maintained control over its borders. The United Nations says it remains an occupied territory, along with the West Bank.
The Palestine Liberation Organisation, led by Abbas, wants the West Bank, Gaza and East Jerusalem for an independent state.