Cairo - After proposing a stillborn truce denying Hamas any gains from its conflict with Israel, Egypt has had to negotiate with the Palestinian militants to halt the war on its doorstep, analysts said.
The initial truce was to have taken effect on Tuesday, apparently coordinated with Israel while bypassing Hamas.
Egyptian mediators have since backtracked from demanding an unconditional acceptance by Hamas and began hosting intense negotiations in Cairo.
"I think that they realised that in order for this to end they will have to reach an agreement that will entail concessions to Gaza," said Nathan Thrall, a Jerusalem-based analyst, referring to Egypt and Israel, which have a 1979 peace treaty.
Egypt's President Abdel Fattah al-Sisi, who last year ousted his Islamist predecessor, Mohamed Morsi, had moved to further isolate the Palestinian movement, a close ally of Morsi's Muslim Brotherhood.
The Egyptian army has destroyed much of a vast smuggling tunnel network that provided Hamas with revenues and weapons, accusing the Palestinians of aiding militants in Egypt's Sinai.
When Hamas's war with Israel erupted last week, Egypt, the traditional broker in such conflicts, cobbled together a ceasefire proposal quickly backed by Israel, Arab governments and the United States, but predictably spurned by Hamas.
The ceasefire conditions, which Egypt demanded both sides accept unconditionally, would have deprived Hamas of the "victory" it desperately seeks following the deaths of more than 200 Palestinians in 10 days of Israeli bombardment.
Hamas, keeping up its rocket fire on Israeli cities that sparked the war, has ruled out any ceasefire before Egypt and Israel agreed to discuss terms.
On Thursday, Israel said it had agreed on a truce with Hamas but the Islamist movement denied a deal had been reached.
Hamas officials said there were ongoing talks on the basis of a set of concessions.
It demands a lifting of Israel's blockade on Gaza, opening of the Rafah border crossing with Egypt, and the release of Palestinian prisoners Israel has re-arrested after freeing them in exchange for kidnapped soldier Gilad Shalit in 2011.
According to Hamas and Israeli media reports, the militants had not been consulted on the initial Egyptian initiative, although Sisi had cleared it with Israeli Prime Minister Benjamin Netanyahu.Hamas 'on defensive'
"It seems to have been an Israel-Egyptian plan" to put Hamas "on the defensive", according to Issandr El Amrani, the International Crisis Group's North Africa project director.
Egypt, he said, was signalling it wanted to broker a ceasefire, but unlike one which Morsi mediated in 2012 that was seen as advantageous to Hamas.
"It wanted to send a message that Egypt is not interested in delivering a political victory for Hamas," he said.
Failure to secure a ceasefire could lead to an Israeli ground operation into the Gaza Strip, an escalation which would result in even higher Palestinian casualties and Israeli casualties.
Despite widespread antipathy in Egypt towards Hamas, such losses would increase domestic criticism of Sisi, said Michael Hanna, an Egypt expert with The Century Foundation, a think-tank based in New York.
As a result, Egypt has had to engage with Hamas and its ceasefire demands during negotiations in Cairo that apart from the movement's deputy leader, Mussa Abu Marzuq, have also involved Palestinian president Mahmud Abbas, who leads the rival Fatah party and is supported by Sisi.
Hamas and Fatah agreed on a unity government of technocrats in June to end a seven-year split.
But the agreement has faltered on Abbas's refusal to pay Hamas civil servants in Gaza, in a further blow for the Islamists.