(Reuters) - Israel and militant Palestinian factions in the Gaza Strip have agreed to an Egyptian-mediated truce to end four days of cross-border violence in which 25 Palestinians have been killed, a senior Egyptian security official said early Tuesday.

The official told Reuters in a telephone call from Cairo that both sides had agreed to end the current operations, with Israel giving an unusual undertaking to stop assassinations and an overall agreement to begin a comprehensive and mutual calm.

The agreement was expected to take effect at 1 a.m. local time. There was no immediate comment from either side on the agreement. Previous ceasefire deals after earlier rounds of fighting have often got off to a shaky start.

Israeli media quoted Israeli officials as reiterating the longstanding policy that Israel would answer quiet with quiet but stopped short of providing any guarantees to withhold fire in response to rocket attacks.

An Israeli military spokesman declined to comment.

A Palestinian official close to the talks said the factions are committed, alluding to the Islamic Jihad and Popular Resistance Committees, who were most active in the fighting, but that these groups were waiting to see how Israel would respond.

Gaza's Hamas leadership, whose own cadres have kept out of the fighting, had confirmed on Sunday that Egypt was working on a deal to stop the violence.

Israel said Gaza militants had fired about 150 rockets at its southern towns and cities from Gaza since fighting flared on Friday after Israel killed a senior militant it accused of plotting to attack Israel from Egyptian territory.

Eight Israelis were injured by the rockets, dozens of which were shot down harmlessly by Israel's Iron Dome missile interceptor system.

Twenty of the Palestinians killed since fighting flared in the Hamas-controlled enclave were militants and five were civilians, according to medical officials.

At least 80 Palestinians, mostly civilians, have been wounded in the violence which also paralyzed life in much of southern Israel, forcing schools to close and hundreds of thousands to remain indoors.

(Reporting by Nidal al-Mughrabi; Writing by Allyn Fisher-Ilan; Editing by Andrew Roche)