* One killed in two violent attacks in Jerusalem
* Palestinians say Israel violated prior ceasefire by killing girl
* Israel says rockets fired out of Gaza after deadline
* Gaza death toll 1,834; 67 on Israeli side (Recasts with Israel, Palestinians heeding Egyptian ceasefire call)
By Nidal al-Mughrabi and Ori Lewis
GAZA/JERUSALEM, Aug 4 (Reuters) - Israel and the Islamist Hamas movement agreed on Monday to an Egyptian-proposed ceasefire to end four weeks of fighting in the Gaza Strip, while Jerusalem was rocked by two attacks that appeared to be a backlash to the violence.
Egypt's plan called for a 72-hour-long truce to begin at 0500 GMT on Tuesday and then for representatives of Israeli and Palestinian factions to attend talks in Cairo to negotiate a longer-term agreement.
Palestinian groups, including envoys of Hamas and Islamic Jihad, met the head of Egyptian intelligence in Cairo earlier on Monday to formulate a plan to end the violence.
A few hours later, Israeli Prime Minister Benjamin Netanyahu's security cabinet agreed to accept Egypt's proposal, an official in his office said, speaking on condition of anonymity.
"Israel has notified Egypt of its acceptance of its proposal for a ceasefire," the official said.
Afterward, Hamas Islamists who dominate Gaza announced their agreement to the truce as well.
"Hamas told Egypt a short while ago of its acceptance of a 72-hour period of calm," Hamas spokesman Sami Abu Zuhri told Reuters.
Israel launched its offensive on July 8 following a surge in Hamas rocket salvoes. It escalated from air and naval barrages to overland incursions centred on Gaza's tunnel-riddled eastern frontier, but also pushed into densely populated towns.
Gaza officials say 1,834 Palestinians, most of them civilians, have been killed, and more than a quarter of the impoverished enclave's 1.8 million residents displaced. As many as 3,000 Palestinian homes have been destroyed or damaged.
Israel has lost 64 soldiers in combat and three civilians to Palestinian cross-border rocket and mortar fire that has emptied many of its southern villages. "Iron Dome" missile interceptors, air raid sirens and public shelters have helped stem Israeli casualties.
Tensions from the fighting seemed to spread on Monday to Jerusalem, where a Palestinian driving an excavator ran over and killed an Israeli and then overturned a bus in what police described as a terrorist or nationalistically motivated attack.
Israeli police shot the excavator driver dead; there were no passengers on the bus.
Several hours later, a gunman shot and wounded an Israeli soldier a short distance away before fleeing on a motorcycle, police said.
Several previous truces barely held with each side refusing to accept terms put by the other, while this time, Egypt plans to convene the parties in negotiations for a longer term deal.
Earlier on Monday, Palestinians said Israel had bombed a refugee camp in Gaza City, killing an eight-year-old girl and wounding 29 other people, in an air attack they said disrupted the start of a previous truce effort.
An Israeli military spokeswoman said there had been no air strikes in Gaza for seven hours on Monday, during which time Israel said it was abiding by a humanitarian ceasefire to free up aid and allow some of the hundreds of thousands of Palestinians displaced by the war to go home.
Israel said Gaza militants continued firing rockets and mortars during the truce period. There were no reported casualties.
Italy said it was sending 30 tonnes of supplies, including tents, emergency generators and water purification kits, to ease living conditions in Gaza.
Media in Britain reported that a British aid worker was killed on Sunday during an Israeli strike in Rafah while he was delivering supplies to a hospital. The British Foreign Office said it was looking into the report.
The military was wrapping up the main objective of the ground assault, the destruction of cross-border infiltration tunnels from Gaza, and it has told residents of some towns they could return home.
A military spokeswoman said some forces were still in action inside Gaza, but the operation was drawing to a close. Media reports said troops had destroyed the last tunnel on their list of targets.
(Additional reporting by James Mackenzie in Rome; Editing by Giles Elgood, Mark Heinrich and Jonathan Oatis)