BEIRUT - Lebanon and Syria formally established diplomatic relations yesterday for the first time since they won their independence in the 1940s, a historic move that was overshadowed by a bombing in the northern Lebanese port city of Tripoli in which 18 people were killed.

The morning rush-hour attack on a commuter bus came as a reminder of the threat of instability still hanging over Lebanon even as a series of peace initiatives in the country and the region appear to be unwinding tensions on multiple fronts.

One of those initiatives is the diplomatic rapprochement between Lebanon and Syria, aimed at defusing decades of friction between the two countries. Syria has played a central role in the turbulence afflicting its smaller neighbor for much of its history, and Syrian troops occupied Lebanon for 29 years starting in 1976.

The decision to exchange ambassadors was announced in Damascus during a landmark summit between Syrian President Bashar al-Assad and Lebanon's new president, Michel Suleiman, who was making the first visit to Syria by a top Lebanese leader since Syrian troops were driven from Lebanon in 2005 by the Cedar Revolution.

It also signaled the growing regional influence of Syria, which in recent months has shrugged off U.S.-led efforts to isolate it diplomatically by embracing a peace deal in Lebanon and opening peace talks with Israel.

Syria, whose territory included Lebanon until the two countries were given independence by France, had long refused to establish relations with its neighbor, saying that the countries are too close to need formal ties. Lebanon has long called for diplomatic relations, suspecting that Syria's refusal masked ambitions to eventually reincorporate Lebanon into Syria.

Washington also welcomed the move.

"We have long stood for the normalization of relations between Syria and Lebanon on the basis of equality and respect for Lebanese sovereignty," U.S. Secretary of State Condoleezza Rice said.

"One of the steps that has long been required has been the establishment of a proper embassy for Syria and Lebanon and vice versa."

The Syrian retreat from Lebanon was followed by a string of high-profile bombings and assassinations of prominent Lebanese figures, which members of the ruling March 14 coalition blamed on a campaign by Damascus to destabilize and ultimately control Lebanon. Lebanon also blames Syria for the February 2005 bombing that killed former Prime Minister Rafiq Hariri, which triggered the Cedar Revolution uprising against Syria's occupation.

But yesterday's bombing in Tripoli did not fit the pattern of those previous attacks, and Syria has now thrown its support behind a new Lebanese government composed of all the country's rival factions - including the Iranian-backed Shiite Hezbollah movement - that was formed in the wake of a peace deal reached in May in Doha.

Tripoli is a mostly Sunni city that has in recent weeks witnessed sectarian clashes between Sunnis and minority Alawites, an offshoot Shiite sect that is aligned with Hezbollah and other pro-Syrian factions. It was also the scene last year of fierce battles between the Lebanese army and a militant Palestinian faction, Fateh al-Islam, which is suspected of ties to al-Qaeda.

Though the militants were routed, some of their leaders escaped and have issued various statements over the last year threatening to stage attacks. They claimed responsibility for killing a Lebanese soldier in the area in May.

The bomb, packed with nuts and bolts and detonated by remote control, went off about 8 a.m. during rush hour just as the bus pulled to the curb to pick up passengers on a main street.

Among the victims of the bombing were nine off-duty Lebanese army soldiers, making Fateh al-Islam a leading suspect.

A statement issued by the Lebanese army also attributed the "terrorist attack" to the "sharp political bickering" that has continued in the country since the peace deal, a reminder that the underlying problems plaguing Lebanon have still not been resolved.