(CNN) -- Flags of Hamas green and Fatah yellow flew alongside the Palestinian Authority flag on the streets of Gaza on Wednesday, as thousands turned out to celebrate the formal adoption of a reconciliation agreement between the two largest Palestinian factions.
The West Bank-based Fatah and the Islamist group Hamas, which rules Gaza, formally adopted a reconciliation agreement Wednesday in Cairo, Egyptian state TV reported.
Speaking at a formal signing ceremony Palestinian Authority President Mahmoud Abbas declared that the parties "will forever turn the page on factionalism" and thanked Egypt for its role in mediating the deal.
Hamas leader Khaled Meshaal said the parties worked tirelessly to reach an accord and promised Palestinians that the parties "will turn a new page" and work together.
In Gaza, men and women chanted, clapped and cried with joy. "(it's) an indescribable feeling of happiness, given that I am a Fatah activist," said O'n Abu Safia, as Palestinian National Authority flags swirled behind him. "It's a beautiful thing to express myself with freedom."
Similar scenes played out in the West Bank. Crowds gathered with flags, and the sound of clapping and singing could be heard as multi-colored balloons were released to the sky.
Crowds cheered outside the building where the deal was inked, Egyptian officials told CNN.
The agreement was initially signed by the parties Tuesday.
Israeli Prime Minister Benjamin Netanyahu had called on the Palestinian Authority to pull out of the deal, saying it would jeopardize the Middle East peace process.
"What happened today in Cairo is a tremendous blow to peace and a great victory for terrorism," he said Wednesday.
During a meeting with Middle East envoy Tony Blair in Jerusalem Tuesday, Netanyahu called on Abbas to "immediately cancel the reconciliation deal with Hamas and choose the path of peace with Israel."
A top aide to Abbas said Wednesday that Hamas, which is formally committed to the destruction of Israel, will abide by some international demands but not others under the deal.
"Hamas will refrain from any violence and ... Hamas will be interested in the peace process," Nabil Shaath said on Israel Radio.
But, he said, "I don't think that Hamas should be asked to recognize Israel. Would Israel recognize Hamas back?"
United Nations Secretary-General Ban Ki-moon welcomed the deal and sent a top representative to the ceremony.
Ban "strongly appeals to all Palestinian parties to commit to these principles" of unity spelled out in the agreement, his spokesman said Wednesday before the signing.
Former U.S. President Jimmy Carter, who helped broker the historic peace treaty between Israel and Egypt three decades ago, hailed the Fatah-Hamas deal as "a major step forward that could bring ultimately what I've wanted for the past 30 years, which is peace in Israel."
The Egyptian-brokered agreement, word of which was first announced last week, seeks to mend the political differences between the two largest Palestinian factions.
But Israel is wary.
"The agreement between Abu Mazen (Abbas) and Hamas is a hard blow to the peace process," Netanyahu told Blair. "How can peace be achieved with a government (in which half of the ministers) call for the destruction of the state of Israel and praises the master killer Osama bin Laden?"
Speaking to CNN on Wednesday Blair said the Quartet of Middle East nations -- the United States, United Nations, European Union, and Russia -- was looking for a new Palestinian government that would "abide by the principles of the international community" and appoint a suitable prime minister and finance minister.
Blair expressed reservations about whether the new government would be able to negotiate a peace deal and cautioned that the reconciliation deal might not meet Palestinian expectations.
"My experience of politics going back many years in a lot of different situations is that if you call for unity, but you haven't actually agreed what you are uniting about, it very rarely holds," Blair said.
The agreement between Hamas, Fatah and other smaller Palestinian factions calls for the establishment of a new Palestinian caretaker government and for parliamentary and presidential elections to be held next year.
It is not clear who might lead a caretaker government, but there has been much speculation in the Palestinian and Israeli media that the current Palestinian Authority prime minister and political independent Salam Fayyad may not be asked to return. Fayyad is reviled by many in Hamas who consider him a lackey for the United States and Israel. He's also resented by many old-guard Fatah officials for the policy control he exerts.
Fayyad is a U.S.-educated former International Monetary Fund official.
His exclusion from a future government would likely contribute to pressure on American and European governments to curtail the hundreds of millions of dollars given to the Palestinian Authority every year. At a news conference Monday in Ramallah, Fayyad downplayed the importance of any future role he may have in the new government.
Officials from Fatah and Hamas said they will form a special committee to handle security, which has been one of the most contentious points of division between the two parties, who have been in open conflict since 2007 when Hamas seized power in Gaza.
Both Israel and the United States consider Hamas a terrorist organization and have voiced strong opposition to the inclusion of the group in any unity government, demanding that it first renounce violence, recognize the state of Israel and abide by all previous agreements.
Netanyahu is scheduled to meet with leaders in London and Paris this week in an effort to convince the international community not to recognize any Palestinian government that might include Hamas.
CNN's Nima Elbagir, Jenifer Fenton and Suzanne Malveaux contributed to this report.