Palestinian President Mahmoud Abbas said Tuesday night that a comprehensive cease-fire had been agreed to in the volatile Gaza Strip after more than a week of factional violence there.
The truce was to take effect at 11 p.m. (2100 GMT), he told reporters.
"There will be a comprehensive cease-fire in Gaza to end all military demonstrations, all shooting will stop and random deployments (of armed men) will end," he said.
"This nation, this people will be united in front of the occupation and aggression and will not be engaged, despite the wounds of the past few days, in internal fighting," Haniyeh said in a televised speech.
News of the truce came after a fierce gunbattle between rival Fatah and Hamas forces erupted outside Gaza's main hospital Tuesday, sparking a day of factional violence that sent students diving for cover in their classrooms and brought life in much of Gaza to a standstill.
Five people were killed and at least 18 were wounded in the violence, which swept away the remains of a tattered truce meant to end a week of fighting that has turned the Gaza Strip into a war zone.
Throughout the day, automatic gunfire echoed throughout the nearly empty streets of Gaza City, and a Fatah security installation was attacked with mortar fire. Masked Hamas gunmen set up makeshift checkpoints on main roads, forces from both sides took up strategic positions and terrified residents shut themselves indoors.
"It's a real war. Since the morning, I've been praying to God that this is going to end," said Suleiman Tuman, a 53-year-old shopkeeper who was trapped in his Gaza City grocery store by the fighting.
"Both sides used to fight the Israelis together. Now they are directing their weapons toward each other and we're in the middle," he said. "Both sides are responsible for this war."
Hamas and Fatah have been locked in a power struggle since the Islamic group defeated Fatah in legislative elections in January. Fatah, which seeks peace with Israel, controls the presidency, while the radical Hamas, which is committed to Israel's destruction, controls parliament and the Palestinian Cabinet.
The fighting began a week ago and intensified over the weekend, when Abbas announced a plan to call early elections as a way to end the political impasse. Hamas has condemned the plan as a coup. In all, 14 people have died in the clashes, making it one of the deadliest bouts of Palestinian infighting ever.
In his wide-ranging, 90-minute speech, Haniyeh blamed Abbas for the violence and political deadlock.
But he also made conciliatory gestures to Abbas. "We have to show self-restraint and dialogue to resolve our differences," he said. "I am calling on everyone to calm down and ease the tensions."
As a first step toward ending the violence, he urged his interior minister to convene a meeting of rival security chiefs later Tuesday to discuss ways to calm the situation.
Jordan's King Abdullah II and the head of the 57-national Organization of Islamic Conference attempted to intervene. Abdullah invited Abbas and Haniyeh to Amman to work out their differences, while OIC chief Ekmeleddin Ihsanoglu shuttled between the West Bank and Gaza talking to the rivals.
"We have some practical ideas to deal with the crisis situation," he said after meeting Abbas. "There are some positive steps. We hope they will be taken."
Hamas spokesman Fawzi Barhoum said the group would consider the Jordanian king's offer to mediate. Abbas' office said he spoke with the king, but gave no further details.
A truce declared Sunday night had brought a brief ebb in the fighting. But after nightfall Monday, it escalated.
The heavy fighting at Gaza's Shifa hospital began shortly after a member of the Fatah-controlled intelligence service, escorted by two armed colleagues, arrived with a broken leg, Fatah officials said.
Hamas militiamen guarding the hospital blocked the armed men from entering and attempted to arrest them. When more Fatah forces arrived, they were fired upon, sparking the gunfight, the Fatah officials said.
Hamas accused Fatah of storming the hospital, and said a 23-year-old member of a Hamas police unit was killed. It also said one of its men was kidnapped.
The battle raged for nearly an hour, sending children scurrying for cover as they made their way to school and frustrating hospital staff.
"We as medical staff are unable to do our work ... in these circumstances while they are shooting and bombing everywhere," Dr. Juma Al Saqqa, director of Shifa's emergency department, told Israel's Channel 2 TV.
The fighting later spread to one of the main offices of the intelligence service, which was attacked by mortars and grenades, security officials said.
In other fighting, a Fatah security official was kidnapped and killed by Hamas gunmen, Fatah officials said, and a Hamas militiaman was killed in a clash with the pro-Fatah intelligence service. Elsewhere, the car of the governor of northern Gaza, prominent Fatah loyalist Ismail Abu Shamallah, was hit by gunfire. He escaped injury.