BEIRUT, JAN. 20 -- Lebanese Shiite militiamen and soldiers abandoned battle positions ringing two battered refugee camps in Beirut today, ending a three-year siege as a show of solidarity with Palestinians in the Israeli-occupied Gaza Strip and West Bank.

Syrian soldiers took over observation posts in and around the Palestinian settlements of Burj al Barajinah and Shatila on Beirut's southern fringes as trucks and armored personnel carriers rumbled away with the gear of the Lebanese Army 6th Brigade, many of whose members are Shiites.

Palestinian women chanted and sprinkled rice and flower petals on the Syrian troops from behind earth mounds and piles of rotten refuse. Syrian soldiers had partially lifted the Shiite blockade of the camps last April when they enforced a cease-fire in the area and allowed women to leave as they pleased.

The blockade, aimed at stopping Palestinian guerrillas from rebuilding their fighting base here, led to a bitter "camp war" that left a total of about 3,000 dead.

The hostilities, which erupted in May 1985, led to a ruthless five-month blockade last year in which refugees were deprived of food and medical supplies.

Men between the ages of 12 and 50 have not dared venture out of the camps since the Palestinian-Shiite dispute erupted, but Shiite leader Nabih Berri announced over the weekend that all such restrictions would be lifted. "Amal decided to lift its military siege around the camps as a gift to our brothers in the West Bank and Gaza Strip," said Berri.

Recent demonstrations, stone-throwing and protests by Palestinian youths against Israeli police and troops in those areas apparently made dismal conditions at the Beirut camps too embarrassing for Syria and its closest Lebanese allies.

Only a trickle of construction materials was allowed into the camps last November to help repair hospitals and mosques, although 90 percent of Shatila was in ruins and 65 percent of Burj al Barajinah had been destroyed.

"How can Amal support the uprising in Gaza and the West Bank while besieging the Palestinian camps in Beirut?" said Amal spokesman Aly Hamdan after the siege was lifted. "The bloody chapter of the camps war has come to an end," he added.

It was evident today, however, that Palestinian distrust could not be replaced overnight. "The hatred of three years cannot be wiped out in three hours of withdrawals," said 27-year-old Mohammed Rahman, a fighter with the Popular Front for the Liberation of Palestine.

"We've been living as prisoners inside. I want to go out of here, to go and see my friends outside, to join a university or find a job . . . Do anything that will let me feel that I am still alive," said a 20-year-old who gave his name as Khaled.

Palestinian males above the age of 11 have not been able to go to schools located on the periphery of the camps, to college courses or jobs.

Some said they were happy to stay in the camps after having grown accustomed to their shabby surroundings.

"I don't really want to leave," said Saeed Helou, 16. "If they could just hook up our electricity so I could watch television and the video, it will be okay."

Describing conditions in the camps, one guerrilla said, "During the war all fighters' movements took place underground, because there was nothing solid or standing above ground. Ordinary citizens lived in 'symbolic rooms,' the remains of what was demolished in every home."

Political observers here said Syria's motives in bringing the camp drama to its conclusion were not altogether altruistic.

"Deployment inside the camps brings them closer into the suburbs and silences critics among their local allies of the bungled handling of Palestinians in Lebanon," one observer noted.

Syria is eager to bring some harmony into the ranks of its Moslem and leftist allies in Lebanon before the country's presidential elections.

Druze chieftain Walid Jumblatt has sided openly with the Palestinians in their conflict with the Amal militia, and the Soviet Union has lobbied behind the scenes to restore harmony between Syria and the Palestine Liberation Organization.