WASHINGTON (AP) _ The State Department today praised the United Nations and three foreign governments - Syria, Iran and Lebanon - as playing helpful roles in the release of longtime hostages Thomas Sutherland and Terry Waite.

''We don't know exactly what roles were played by different people, but these are the people that appeared to have had a role,'' Richard Boucher, a State Department spokesman, said in announcing Sutherland and Waite were in Syrian hands and on their way to Damascus from captivity in Lebanon.

Syria and Iran are listed by the State Department as sponsors of terrorism and Lebanon has functioned largely under Syria's influence. The Bush administration's public expression of praise for all three governments was in sharp contrast to that background.

It also enhanced Syria's standing as the Arab country participates in Mideast peace talks engineered by Secretary of State James A. Baker III.

Only last week, Syria got another boost. The Bush administration, blaming Libya for the bombing of a Pan Am passenger plane, said there was insufficient evidence to implicate Syria.

The radical Arab country had been under suspicion since Pan Am 103 exploded over Scotland in December 1988, killing all 259 people aboard and 11 on the ground.

''The evidence does not lead to Syria in this case,'' Boucher said today.

Another U.S. official, speaking on condition of anonymity, said earlier that a U.S. medical group had been sent to Germany and other hostage experts were on their way to Lebanon.

Sutherland, 60, dean of agriculture at the American University in Beirut, was kidnapped June 9, 1985 by gunmen as he drove in a convoy from Beirut airport. A native of Scotland, he is a naturalized American citizen who lived in Estes Park, Colo.

Waite, 52, was the special envoy of the Archbishop of Canterbury and had arranged the release of other hostages in Lebanon. He spent nearly five years in captivity himself after being kidnapped on Jan. 20, 1987, after going to meet with the Islamic Jihad.

Sutherland was the second-longest held of the hostages. Only Terry Anderson, chief Middle East correspondent for The Associated Press, has spent longer as a hostage. Anderson, 43, was seized on March 16, 1985.

The other hostages are: Joseph James Cicippio, acting comptroller at the American University in Beirut, kidnapped Sept. 12, 1986; Alann Steen, a communications instructor at Beirut University College, kidnapped Jan. 24, 1987; Alberto Molinari, an Italian businessman who lived in Beirut, kidnapped Sept. 11, 1985; and West German relief workers Heinrich Struebig and Thomas Kemptner, kidnapped May 16, 1989.