In a palace overlooking Islam's holiest site, rival Palestinian leaders vowed Wednesday to hammer out a power-sharing agreement to avert a civil war, asking their followers to abide by a truce during the marathon talks crucial to the peace process with Israel.

But threats of new revenge attacks arose in Gaza after the killing of a Hamas activist the night before — underlining the danger of an explosion of new factional fighting if the talks in Saudi Arabia fail.

"We will not leave this holy place until we have agreed on everything good, with God's blessing," Palestinian leader Mahmoud Abbas said at an opening ceremony for the Mecca talks, sitting alongside his rival Khaled Mashaal, head of the militant Hamas group.

"I tell our people to expect good news, and I hope this (meeting) will not be mere words in the air," Abbas said at the ceremony, which was aired live on television across the Mideast.

Mashaal turned to Abbas and said they both had to tell their supporters to respect the truce, to which Abbas nodded his agreement. "We want to give a message to the nation, and the world, to create a positive atmosphere for these talks," Mashaal said.

"We came here to agree and we have no other option but to agree," the Hamas leader said.

The talks were held in a palace overlooking the Kaaba, the cube-shaped shrine that is Islam's holiest site, toward which all Muslims face when praying. Saudi television repeatedly moved from scenes of the ceremony to images of the Kaaba — reflecting Saudi hopes that the sacred venue will press the two sides to compromise and resolve their differences.

Both sides sounded optimistic during talks Wednesday night. Nabil Amr, a spokesman for Abbas, said he hoped to reach a deal on a new coalition government within 48 hours. "We have finished the general talks and exchanges of views. Now we have started discussions over forming the Cabinet and its political program," he told the Associated Press.

"The atmosphere is positive. I expect to reach a deal on sharing power — we have no alternative but to reach a deal," said Mohammed Nazal, of the Hamas delegation. Talks were to continue through the night.

The gathering is a high-stakes bid by Saudi Arabia to put an end to the bloodshed between Palestinians that has killed dozens in the past months — including 30 in a round of fighting in Gaza that ended with a fragile truce Sunday.

Saudi Arabia wants the Palestinians to reach a deal on a coalition government not only to end the bloodshed but also so that the long-stalled Israeli-Palestinian peace process can resume — something the kingdom believes is vital to reduce tensions across the Mideast.

In two rounds of talks between Abbas and Mashaal on Wednesday, Saudi King Abdullah and Ssaudi officials did not participate, trying to let the two sides work out the issues by themselves. Abdullah hosted a lunch in which the two leaders sat on either side of the monarch.

But Abbas aides said they may need more direct intervention from Abdullah — a sign of how difficult the few final obstacles to a deal may be to overcome.

Fears of more violence continued in Gaza. Hamas militants warned of new violence unless Fatah officers they accuse of being behind an attack last week on an Islamic university are handed over by the end of the day. Hamas also accused Fatah in the slaying of one of its members in a shooting Tuesday night — though the attack may have been an instance of clan warfare that has overlapped the political battles.

The goal of the Mecca talks is to form a coalition government that includes the militant group Hamas — which swept Palestinian elections in January 2006 — yet still recognizes previous peace agreements with Israel. Hamas has long refused to recognize Israel and the past peace accords signed by the Palestine Liberation Organization, of which Fatah is the major member. Talks have also stalled over the issue of who would control security forces in any new Palestinian government.

Israeli Foreign Minister Tzipi Livni said Wednesday that her country would not accept any Palestinian government that does not explicitly renounce violence and accept the right of Israel to exist.

Her comments raise the question whether any coalition government that comes out of Mecca will be accepted as a peace partner by Israel, which has refused to talk to the Hamas-led government, though it has held talks with Abbas, who was elected separately in 2005.

Fatah officials have said Abbas has underlined to the United States — Israel's top ally — the need for flexibility in the conditions for a new government. He is trying to get Hamas to sign onto a government program in which the militant group would "commit" to previous peace deals between Israel and the Palestinians — implying recognition of Israel and a renunciation of violence.

But so far, Hamas has insisted on weaker terminology by which it would "respect" previous deals. Part of the deadlock centers on that language — and the two sides are also split on the crucial issue of who would control Palestinian security forces.

Hamas has its own worries about giving up its tough stance in Mecca — then failing to reach Palestinian goals in any future talks with Israel, which would hurt its credibility among Palestinians.

"Who can guarantee that we will not be making a mistake if we give concessions?" Nazal said. "Will we get an independent Palestinian state with Jerusalem as its capital?"

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