JERUSALEM - The killing of two Israeli security guards by a Palestinian gunman Friday focused attention on one of the biggest challenges facing Mideast peace negotiators: keeping extremists in check.

Israel says the moderate Palestinian leadership with whom it hopes to strike a peace deal by year's end is failing to ensure the calm necessary for any Israeli withdrawal from the West Bank.

A Palestinian militant, apparently pretending to be a laborer, shot and killed two middle-aged guards who were screening Palestinian workers as they entered an Israeli factory in Nitzanei Shalom, along the divide between Israel and the West Bank.

The Palestinian government led by President Mahmoud Abbas says it is making great strides in imposing order in the West Bank, the only area it controls following the June 2007 violent takeover of the Gaza Strip by Hamas militants. But Israel says Abbas' forces have a long way to go before establishing the security control that would prevent the West Bank from meeting the same fate as Gaza, where militants capitalized on a 2005 Israeli withdrawal for launching incessant rocket attacks.

Palestinian Foreign Minister Riad Al-Malki condemned the shooting and said it was meant "to undermine the efforts by the Palestinian government to undertake full security responsibilities in the West Bank."

The overall situation in the Palestinian territories appears to be working against the delicate efforts by Abbas and Israel to forge a deal.

Israel is pushing forward with controversial building projects on disputed land in the West Bank and east Jerusalem and is refusing to take down illegal settlement outposts, release Palestinian prisoners, halt military incursions, and dismantle roadblocks that severely disrupt daily life.

All this, combined with the Palestinians' failure to rein in militants, as evidenced by Friday's shooting, are making the goal of a peace deal by year's end appear increasingly unrealistic. It's also making high-profile meetings like the one Thursday between Abbas and President Bush in Washington look somewhat removed from reality, despite the leaders' public expressions of optimism.

Medics pronounced the two guards dead at the scene, rescue services said, and troops began combing surrounding areas for traces of the assailant. One body remained on the ground outside the factory, covered in a gray blanket, and police concealed the second body with a white sheet.

Three militant groups took responsibility for the attack -- Hamas, Islamic Jihad and a violent offshoot of Abbas' moderate Fatah movement. An Islamic Jihad spokesman, Abu Mujahed, said in a phone call to The Associated Press that the gunman crossed into Israel several days ago dressed as a woman and then pretended to be a worker to get close to the factory.

The assailant then began shooting and was slightly wounded in an exchange of gunfire but managed to escape, said Abu Mujahed, who gave only his nom de guerre because he is wanted by Israel.

"This was a clear example of extremism and terrorism by those seeking to foil any prospects for advancing peace between Israel and the Palestinians," said Israeli government spokesman David Baker.

Israel's military regularly carries out arrest raids targeting militants in the West Bank, and Israel has refused Palestinian calls to cease such operations and allow Palestinian security forces to take control. Under a U.S.-backed peace plan, Palestinians are supposed to dismantle violent groups.

Shootings such as Friday's are relatively rare in the West Bank. Most Israeli-Palestinian violence takes place in and around Hamas-ruled Gaza.

Hamas said Thursday it would be prepared to accept a cease-fire with Israel that applies to Gaza only, dropping an earlier demand that any truce include the West Bank as well.

However, Hamas also demands that any deal include a lifting of Israel's blockade of Gaza's border crossings, imposed to weaken the militants' rule and end the ongoing rocket fire.

On Friday, about 7,000 protesters carrying Hamas flags gathered near Gaza's northern and southern borders, demanding an end to the blockade.

Baker, the Israeli government spokesman, expressed skepticism over Hamas' latest announcement.

"To Israel's dismay, Hamas is not serious. It's playing games, trying to buy time in order to regroup and rearm," he said.

Israelis got a reminder Friday of what they'd be up against if they tried to uproot Jewish settlers in the West Bank as part of any future peace deal.

Left-wing activists protesting settlers' presence in the biblical city of Hebron -- long a hotbed of Israeli-Palestinian tension -- were pelted by settlers with eggs, sticks and stones, the protesters said.

Members of B'Nai Avraham -- whose name means Sons of Abraham, a reference to the shared patriarch of Jews and Muslims -- chanted "One, two, three, four, occupation no more," when they began scuffling with settlers.