Israeli tanks and troops withdrew early Thursday from this Palestinian town, ending a two-day takeover after Palestinian gunmen said they would stop firing at a nearby Jewish neighborhood. 

The understanding was reached in intense Israeli-Palestinian phone diplomacy, with help from U.S. Secretary of State Colin Powell and European Union officials.

Israeli tanks and jeeps drove out of Beit Jalla just before dawn Thursday. After daybreak, residents gathered in the streets in celebration. Masked gunmen shot in the air, and women clapped and cheered. One gunman in a ski cap had ammunition belts draped across his chest and fired burst from a machine gun.

Also Thursday, an Israeli man sitting in a restaurant in a Palestinian village was killed by a shot to the head by a Palestinian militant, police said. The masked assailant fled, said police spokesman Rafi Yaffe.

In the Gaza Strip, Israeli troops barred a convoy with senior U.N. officials, led by Peter Hansen, commissioner of the U.N. Relief and Works Agency, from passing a roadblock. Hansen was on his way to the Rafah refugee camp to inspect homes demolished by Israeli army bulldozers a day earlier.

Israeli troops have been blocking the main access road to Rafah since Wednesday, with a tank parked across it and more armored vehicles positioned nearby. When the five-car U.N. convoy, accompanied by journalists, approached the roadblock Thursday, Israeli troops did not let it pass.

Hansen got out of his vehicle, wearing U.N. uniform and a bulletproof jacket. A soldier atop the tank shouted at him in English: ``Go back immediately, or we are going to shoot.'' The U.N. convoy eventually turned back and Hansen said it would try to reach Rafah on backroads.

The army said it permitted Hansen to pass, but that he declined. Journalists witnessing the scene said no such offer was made.

Earlier in the day, Palestinian leader Yasser Arafat's convoy was permitted to pass along that road, with his armored limousine weaving through the barriers. Arafat was en route to Durban, South Africa, to attend a U.N. conference on racism.

The Israeli pullout from Beit Jalla came two days after Israeli tanks and troops entered the West Bank town, following a heavy exchange of fire between Palestinian gunmen there and Gilo, a Jewish neighborhood built on war-won land and annexed to Jerusalem.

Witnesses said the tanks and armored personnel carriers withdrew after the shooting stopped around midnight, five hours before the withdrawal began.

Israeli Defense Minister Binyamin Ben-Eliezer said troops would remain near the town to ensure that the gunfire would not resume, but stopped short of threatening another raid in the event of renewed shooting.

``If the shooting is resumed, we will consider our steps. We have to act with presence of mind, judiciously,'' he said. ``I don't want to threaten, but hope that this time Arafat will keep his word.''

The withdrawal followed a late-night meeting of top government officials, including Prime Minister Ariel Sharon, Foreign Minister Shimon Peres and Ben-Eliezer. Peres raised the possibility that once calm was restored in Beit Jalla and Gilo, he could begin talks on a comprehensive truce with Arafat next week.

In Beit Jalla, Palestinians celebrated the withdrawal as a victory. ``Our people taught the Israeli occupation a big lesson,'' said Hassan Abed Rabbo, the local leader of Yasser Arafat's Fatah group.

Families whose houses had been occupied by the Israeli soldiers were visited by well-wishers. ``My house was the first to be occupied and the last to be liberated,'' said Bishara Kharouf, 56. ``I cannot describe my feelings, but it is freedom.''

Israel's two-day presence in Beit Jalla marked the longest incursion into Palestinian territory since the fighting began 11 months ago. The United States sharply criticized the raid, and the withdrawal highlighted the relative limitations in Israel's array of reprisals for Palestinian attacks.

Heavy shooting on Gilo earlier this week had been triggered by the killing of a senior PLO official, Mustafa Zibri, in a pinpointed Israeli missile attack.

In the two days when Israeli forces held positions in the town, Palestinians continued to fire on Gilo. For the first time, the Palestinians fired 50-caliber machine-guns and 60mm mortars at the Jewish neighborhood.

In the exchanges of fire in Beit Jalla, one Palestinian policeman was killed and at least 20 people were injured, Palestinians said. An Israeli was wounded in Gilo just before the incursion began.