Political leaders in this northern Lebanese port are mending old feuds and talking about national reconciliation, but gunfire still is heard almost every night in the streets.

Syrian and Palestine Liberation Organization troops, together with at least a dozen local armed groups, eye each other warily and occasionally clash in brutal fighting.

The lineup of forces roughly is the same explosive mixture as it was throughout the country before Israel invaded in early June. But in this largest Lebanese city still unscarred by Israeli shells, shoppers fill the streets and generally ignore the foreign soldiers or local militiamen carrying rifles among them.

Still, each neighborhood has dozens of armed youths, who fire numerous rounds of ammunition in the air in shows of bravado at night and on occasion use their weapons seriously.

Residents say there now is a genuine desire for peace on all sides, but the planned evacuation of PLO guerrillas and Syrians could leave some civilian groups unprotected and encourage rivals to attack. PLO military police wearing maroon berets and wielding Kalashnikov assault rifles guard the nearby Palestinian camps that are, in effect, the last remaining strongholds of the guerrillas in Lebanon.

The fragility of the balance of power here could raise problems for President Amin Gemayel and U.S. envoy Morris Draper as they seek to negotiate the withdrawal of foreign troops. Local politicians say the Lebanese Army needs at least six months of training and expansion before it could maintain security.

The biggest problem in evacuating foreign forces from the north is likely to be finding a replacement for the PLO guerrillas guarding the 50,000 Palestinian civilians living in the two refugee camps northeast of here. Several residents, recalling the killing of hundreds of Palestinian civilians in Beirut after the PLO's departure from there, said they wanted the guerrillas to stay.

"After the massacre at Sabra and Shatila, we're not going to believe that the Lebanese government or the United States can protect us," a low-ranking PLO official at one of the camps said.

It is not clear exactly who the Palestinians here fear. The two private armies charged with involvement in the Beirut massacre -- the Phalangist Lebanese Forces and the militia of the renegade Lebanese Army major Saad Haddad -- are not active this far north.

Some Palestinians think Israel may drive north, bring along the Phalangist and Haddad forces, besiege the camps and drive out the PLO to finish the job begun in the south. Generally, though, they seem to be afraid that they would be the victims in a renewal of the sectarian violence that has afflicted Lebanon for seven years.

"What happened before in Lebanon was civil war, and the same will happen again," a middle-aged Palestinian woodworker said in his neat, two-story cinderblock home.

PLO Chairman Yasser Arafat has indicated in a message to Gemayel that the PLO guerrillas will withdraw if Gemayel asks. Arafat suggested that the PLO would not allow Israel to use the Palestinians' presence to justify continuing its occupation of the south.

"The people are afraid, but there is policy to follow," one young PLO activist said. He said there was some tension between the civilians living in the camp, who want the fighters to remain, and the PLO leadership over the issue.

The other group opposed to the evacuation of foreign forces is the local Alawite community, adherents of a branch of Islam that also is followed by the Syrian ruling elite. Syrian troops have backed the Alawites in their rivalry with the more numerous Sunni Moslems.

Since last summer, the heaviest fighting in Tripoli has been between the Alawites in the slum of Baal Mohsen in the northeastern outskirts of the city and the Sunnis in the neighboring shantytown of Tebbane. In late September, 20 persons died when militias of the two groups fought for three days with mortars, rocket-propelled grenades and automatic rifles. Syrian soldiers from a nearby barracks joined in the fighting on the Alawites' side.

Some diplomats in Beirut fear that the Alawites would face a bloodbath if the Syrians left. They suggest that an expanded multinational peace-keeping force may be needed to guard both the Alawites and the Palestinians.

Tripoli residents acknowledge that the Sunnis might be tempted to take revenge on the Alawites, but they also suggest that the presence of foreign forces itself has been the prime cause of the trouble.

In this view, the Syrians encouraged the Alawites to try to widen their influence in the city--such as by taking control of some port operations--and thus alienated the Sunnis. The Syrians themselves are not well liked and are accused widely of car thefts and other crimes.

In addition, the fighting between the Lebanese Sunnis, who are close to their fellow Sunnis in the PLO, and the Alawites to some extent reflects tensions between the PLO leadership and the Syrian government. The fighting in September, for instance, was blamed in part on disagreements between the PLO and Syria over Arafat's opening to Jordan's King Hussein, who has bitter relations with Damascus.

Former prime minister Rashid Karame, leader of Tripoli's Sunni community, insists that the Alawites would be safe.

"We are able to bring a halt to any incidents," he said in an interview. A committee of local Moslem leaders led by him has played a key role in stopping Sunni-Alawite clashes.

Karame and other sources emphasized that the years of fighting have exhausted Tripoli and encouraged a spirit of putting aside old vendettas.

"The people want peace," the local correspondent for the independent Beirut daily An Nahar said. "Everybody is with the new president in completing a reconciliation."

An important sign of the new mood is the cooperation cautiously offered to Gemayel by northern Lebanon's Christian elder statesman, former president Suleiman Franjieh. He still nurses a personal grudge against the Gemayel family because Amin's assassinated younger brother Bashir reportedly ordered the killing of Franjieh's son Tony in 1978 in an intra-Christian struggle.

Franjieh has come under considerable pressure from public opinion not to be a spoiler, and he has spoken on the telephone with new president Gemayel and exchanged messages of mutual support.

Franjieh, who has a Christian militia, and Sunni political boss Karame also are continuing a truce begun in 1977 lifting Moslem-Christian tensions.

The existence of so many armed groups, however, is a continual threat to peace. In addition to the Syrian and PLO troops, and the Sunni, Alawite and Franjieh militias, Christian industrial workers are grouped in several left-wing bands and the Phalangists are only an hour's drive south.

Virtually the entire community is said to be armed. Signs at the International Red Cross office proclaim in Arabic, English and French: "Access to the premises is forbidden to all persons carrying a weapon."