WASHINGTON — Congress on Thursday approved legislation that will allow the State Department to settle all remaining lawsuits against Libya by U.S. terrorism victims.

The bill paves the way for healing the last rifts between the U.S. and Libya but only after the country fully compensates Americans harmed in Libyan-sponsored attacks, including the 1988 bombing of Pan Am Flight 103 over Lockerbie, Scotland and the 1986 bombing of the La Belle discotheque in Berlin.

The Senate passed the measure without objection Thursday. The House followed suit later in the day, sending it to President Bush, who is expected to sign it.

It creates a new fund to compensate the victims and grants Libya immunity from terror-related lawsuits once the secretary of state certifies that they have been paid.

The measure could lend momentum to the Bush administration's attempts to restore full ties between Washington and Tripoli, which have stalled over the terror claims. Congress has blocked direct aid to Libya, the construction of a new U.S. embassy there, and the confirmation of the first U.S. ambassador to the nation until U.S. victims are paid.

"For too many years, Libya has refused to accept responsibility for its horrific acts of terrorism against American victims. But after the pressure we applied, Libya can finally be held accountable for these devastating events," said Sen. Frank R. Lautenberg, D-N.J., who led the congressional efforts to deny Libya aid and diplomatic benefits. "Now these victims and their families can get the long overdue justice they deserve."

The State Department said the measure was a good outcome for victims' families.

"It will allow them the fair and just compensation that they've been seeking in an expeditious manner," spokesman Sean McCormack told reporters. He said it would also "allow the United States and Libya to finally close the book on a contentious period in our relationship and to look to the future."

Victims' families also cheered the measure.

Kara Weipz, whose brother Rick Monetti was killed on Pan Am 103, called it "a critical step in our fight for justice for our loved ones."

In a statement on behalf of the Lockerbie families, Weipz said it's now up to Secretary of State Condoleezza Rice "to ensure justice is served expeditiously."

Libya has paid the 268 families involved in the Pan Am settlement $8 million each and owes them $2 million more.

Other U.S. victims, however, said the measure would deprive them of just compensation.

Families of the 170 people killed in the 1989 bombing of French UTA Flight 772 from the Republic of Congo to Paris, in which Libya was also implicated, denounced the bill.

"Any settlements by other victims should not be at the expense of those who have fought and won in the courts," they said in an open letter to Congress.

Stuart H. Newberger, a lawyer for UTA 772 families, said the measure would allow his clients to recover only a small fraction — 5 percent to 10 percent — of the $1.7 billion a federal court awarded them in January.

The bill lets the Pan Am and La Belle victims, who already have settlements with Libya, recover the full amount they're owed, but leaves it to the secretary of state to determine what constitutes "fair compensation" in other cases.

The U.S. had no diplomatic relations with Libya from 1980 until late 2003, when leader Moammar Gadhafi pledged to abandon his weapons of mass destruction programs, stop exporting terrorism and compensate the families of victims of several attacks, including the Pan Am 103 bombing.

Those steps marked the beginning of the end of decades of international pariah status for Libya, once so reviled that it was the target of U.S. airstrikes ordered by President Reagan in 1986.

Libya was given a reprieve from U.N., U.S. and European sanctions, removed from the State Department's list of state sponsors of terrorism and allowed a seat on the U.N. Security Council.

But the rapprochement hit a snag over the compensation claims.

Rice, who has said she hopes to visit Libya to mark the turning point in relations, has for months been trying to resolve the situation, and the top U.S. diplomat for the Middle East, David Welch, has held numerous meetings with Libyan officials on the matter, the last of which was earlier this month in Abu Dhabi.