Rival Palestinian leaders signed an agreement on a power-sharing government Thursday in Saudi-brokered talks in Mecca. Under the deal, the militant Hamas group promises to "respect" peace deals with Israel.

Palestinian President Mahmoud Abbas, of the mainstream Fatah movement, and Khaled Mashaal, leader of the militant Hamas group, signed the accord at a ceremony hosted by Saudi King Abdullah in a palace overlooking the Kaaba, Islam's holiest shrine.

The deal sets out the principles of the coalition government, including a promise that it will "respect" previous peace deals with Israel, delegates said. It also divvies up Cabinet posts in the new government.

Announcing the agreement at the ceremony, Abbas aide Nabil Amr read a letter in which Abbas designated Prime Minister Ismail Haniyeh, of Hamas, to draw up the new government according to the formula agreed on in the talks within five weeks.

Abbas said the deal would "satisfy our people ... and bring us to the shores of peace ... This initiative has been crowned with success."

Mashaal said the accord "will unify our ranks. There is a commitment and unity. We will perseve this partnership."

The letter of designation, read by Amr, said the new government led by Haniyeh would "respect" past peace deals signed with Israel by the Palestine Liberation Organization, dominated by Fatah.

It said it would also follow a document drawn up last summer by Hamas and Fatah activists jailed in Israeli prisons. That document calls for a Palestinian state in the West Bank, Gaza and east Jerusalem, the areas Israel captured in the 1967 Mideast War.

Hamas' agreement to that part of the platform is its most concrete commitment yet to a two-state solution to the Israeli-Palestinian conflict, though Hamas has underlined that it does not necessarily mean recognition of Israel.

In drawing up the new government, Hamas is to propose an independent candidate to hold the crucial post of interior minister, who would control the Palestinian security forces. Abbas would then approve the candidate. The Interior Ministry post was one of the main obstacles to the deal, with each side loathe to see it in the hands of the other.

Click here to go to FOXNews.com's Mideast Center.