The Shiite Moslem militia fighting Palestinians around three refugee camps south of Beirut declared a cease-fire today, but it was marred at sundown when gunners lobbed shells and rockets into Christian and Moslem areas from the surrounding mountains.

The cease-fire was announced by Nabih Berri, leader of the Shiite Amal movement, after both Amal and the Palestinians confirmed that the Sabra refugee camp had fallen to the Shiites after a decisive dawn battle at its northern entrance.

Meanwhile, President Amin Gemayel returned from Damascus after two days of intensive talks with Syrian President Hafez Assad on political reforms, security and an expanded Syrian role in managing the Lebanese crisis.

The talks were shrouded in vague language and secrecy about whether Syrian troops would be redeployed in Beirut to put an end to the 12-day-old fighting, which has pitted Amal against Palestinian guerrillas, including supporters of Palestine Liberation Organization leader Yasser Arafat as well as his Syrian-backed rivals.

Gemayel told reporters in Damascus last night that Syrian troops already in eastern and northern Lebanon could help the Lebanese Army enforce order to allow political reforms to go ahead. Syrian troops "could form a strong force capable of implementing such a plan in cooperation with the legitimate Lebanese Army," Gemayel said.

Although this was the highest level Lebanese reference to a Syrian role here since 1982, its implementation remained unclear. Some reports spoke of Syrian observers with the Lebanese Army, while others indicated that Syrian troops would take mountain positions overlooking Beirut that would enable them to provide support when needed.

Berri, who is also justice minister and state minister for southern Lebanon, declared today's cease-fire to allow for the evacuation of wounded Palestinian guerrillas from the Burj al Barajinah refugee camp south of Beirut.

Negotiated by an Algerian delegation and under Syrian pressure, the truce was interrupted by spurts of machine-gun fire and sniping in the Shatila camp.

A Palestinian spokesman said contact with guerrillas defending the adjacent Sabra camp had been lost last night after they fought "a heroic battle."

At the United Nations Friday, the Security Council unanimously called for an end to fighting in the three camps and asked that U.N. and Red Cross officials be given access to the victims, United Press International reported. Lebanon rejected the call as "blatant interference" in its affairs.

In announcing the cease-fire, Amal said it was acting "in response to the wishes of President Hafez Assad and Syria to allow Red Cross workers and rescue teams to enter Burj al Barajinah."

An official of the Damascus-based National Palestinian Salvation Front, a grouping of Palestinian guerrillas opposed to Arafat, said Palestinians would abide by the truce, which he said was concluded for "humanitarian" purposes. Nayef Hawatmeh, leader of the Democratic Front for the Liberation of Palestine, appealed to the Arab League and Iranian leader Ayatollah Ruhollah Khomeini to intercede to save the lives of Palestinian fighters trapped inside the camp.

Residents heard explosions in Sabra after the truce was implemented and assumed Shiite militiamen were blowing up houses. Bulldozers manned by Amal gunmen were seen driving in the direction of the camp.

State-run Beirut radio and television quoted security officials as saying that rockets and shells were fired into the greater Beirut area, which includes both the Christian eastern and predominantly Moslem western sectors. The source of the fire was given as the Druze-held hills southeast of Beirut, where anti-Arafat Palestinians, followers of dissident leader Abu Musa, are entrenched.

Four persons were killed and one seriously injured from the rocketing in the Christian quarter of Ain Rummaneh. Extensive damage was caused to buildings in the southern suburbs and adjoining communities in the Moslem sector of Beirut, but there were no initial reports of casualties.

In southern Lebanon, Shiite guerrillas said they had captured 26 members of the Israeli-backed South Lebanon Army militia in an early-morning attack on a post close to the Ghanaian battalion of the United Nations Interim Force in Lebanon (UNIFIL). The Shiites claimed to have attacked the villages of Majdal Silm, Tulin and Safad al Batikh in the newly demarcated security belt north of the Israeli border to seize positions taken over by the South Lebanon Army from the departing Israelis.

Israeli soldiers evacuated key positions in the security belt in advance of next week's scheduled final pullout. In the Christian town of Marjayoun, Israeli soldiers left an Army barracks where the South Lebanon Army is headquartered, leaving liaison officers, reports from the area said.