A meeting of Palestinian leaders in Gaza has reached a milestone reconciliation pact that will see rival Palestinian groups form a national consensus government in five weeks - after seven years of operating under separate administrations.

Under the agreement announced on Wednesday, rival groups Fatah and Hamas will form a government together under the umbrella of the Palestinian Liberation Organisation (PLO).

The groups plan to form a national unity government in five weeks and will hold elections in six months.

At a news conference, leaders of all the groups said the past divisions had taken a toll on the Palestinian goal of establishing an independent state with Jerusalem as its capital.

Ismail Haniyeh, the Hamas leader who announced the terms of the agreement, said the deal came as "the entire city of Jerusalem has been painted Jewish with an attempt to wipe out the Arab identity and desecrate the Muslim and Christian sanctities".

Azzam al-Ahmed, the Fatah delegation head, said he hoped the pact "will be a true beginning for a true partnership in all our spectrums; political, social and societal".

The Palestinian factions have been at odds and sometimes even at war with each other since 2007 – following Hamas’s democratic win in Gaza.

Since then, Hamas has independently ruled the 40-kilometre long Gaza strip, home to nearly 2 million Palestinians - while Palestinian President Mahmoud Abbas, from Fatah, governs areas of the West Bank – home to more than 2 million Palestinians.

The two-sides met and signed deals in 2011 and 2012 in meetings in Cairo and Doha – but never with the desired result of unification.

The new agreement, reached in only two days, will honour the terms of both agreements.

The deal also comes at a crucial time when the US-led talks between the Israelis and Palestinians are at a stalemate.

Israel cancelled a session of peace negotiations scheduled for Wednesday night after the announcement of a new Palestinian government.

Benjamin Netanyahu, the Israeli prime minister, said in a statement that "whoever chooses Hamas does not want peace".

"I said this morning that Abu Mazen (the Fatah-backed Palestinian President Mahmoud Abbas) needs to choose between peace with Israel and an agreement with Hamas, a murderous terrorist organisation that calls for the destruction of Israel and which both the United States and the European Union define as a terrorist organisation," Netanyahu said.

Avigdor Liberman, the Israeli foreign minister, described the signing of the agreement as "tantamount to a signature on the end of negotiations between Israel and the Palestinian Authority".

Some Palestinians, weathered by divisions in the past, told Al Jazeera they remained sceptical of the new agreement.

Ramallah resident Nur Hamad, said she supported reconciliation "because we have to be one nation".

"No factions, only a Palestinian nation, but I don't think Fatah and Hamas are going to succeed," Hamad said.

And Mariam abu Daqqa, an activist in Gaza said, "We are saying to both Fatah and Hamas for the sake of Palestine and the Palestinian children, you must get unified against the Israeli occupation."