Both Hamas, the Islamic Resistance Movement, and Islamic Jihad, a smaller militant group, claimed responsibility for the attacks, demonstrating that Islamic extremists remain determined to use violence to overturn the Gaza-Jericho agreement.
Palestinian commanders came under immediate pressure from Israel to round up the gunmen. However, the generals showed no immediate ability or willingness to take action.
The attacks coincided with the arrival in Gaza of Nabil Shaath, the chief Palestinian negotiator. Making his first visit to Gaza since 1964, Mr Shaath found himself embroiled in the first security crisis of the handover, and he carried out intensive negotiations with his Israeli counterparts to determine the next step.
Both sides were acutely aware that indecision could fuel new tension on Gaza's highly volatile streets, where thousands of Palestinian police now roam without any apparent sense of purpose.
'I am sorry the attacks happened,' said Mr Shaath, attempting to calm the atmosphere after emerging from the new Palestinian police headquarters in Gaza where he met General Nasser Youssef, head of the Palestinian police. 'We have to do our best to prevent and pre-empt the acts occurring. But I am not alarmed. The spirit in which the agreement is being applied is encouraging.'
General Youssef would not say what action was considered, saying: 'Hamas will not control the situation.' Earlier in the week the general said he would disarm the militants, but later clarified his comments saying there would be a new gun licensing system.
Although Israel reacted by closing off the Gaza Strip, Israeli commanders did not order their forces to pursue the attackers into Palestinian-controlled territory. Under new rules of engagement Israel maintains a right of hot pursuit. The attack against the soldiers took place about 1km inside the Gaza perimeter, where the Israeli army still has a checkpoint. The gunmen shot dead the two soldiers, then escaped back into the Palestinian area.
The second attack, against settlers, took place near the main settlement block of Gush Qatif.
The transfer of authority from Israeli forces to Palestinian police, under way for a week, had been carried out with relative calm, raising hopes that armed opponents had agreed to a truce.
However, the attacks were timed to cause maximum confusion, exposing the vulnerability of the Palestinian police who answer to no Palestinian authority as yet, and act in a power vacuum. Soundings in Gaza yesterday suggested the attacks were supported by many Palestinians, who remain highly sceptical about the agreement.
'Fantastic,' said Suhel Mohammed, 20, describing the killings. 'I hope the attacks continue until all the Israelis are gone. They are still close by in Gaza at the checkpoints and settlements.'
For Israelis the attacks appear to confirm their worst fears: that the new enclaves would be used as safe havens for the gunmen.
The anger of the Israeli right wing was spelt out yesterday by Benjamin Ben-Ellisar, a leading Likud member of the Knesset, who said: 'The agreement is against nature. How can a free and powerful nation like Israel try to strike a peaceful agreement with a snake, an Arafat, the PLO?'