The top U.S. diplomat for the Middle East, David Welch, signed the deal with Ahmed al-Fatouri, head of America affairs in Libya's Foreign Ministry, in a ceremony before reporters and members of both delegations.
There were 26 pending lawsuits filed by American citizens against Libya for the 1988 bombing of Pan Am Flight 103 over Lockerbie, Scotland, and other attacks, said a senior Libyan government official, who spoke on condition of anonymity because the details of the deal had not been publicly announced.
He said there were also three outstanding lawsuits filed by Libyan citizens for U.S. airstrikes on Tripoli and Benghazi in 1986 that Libyans say killed 41 people, including Moammar Gadhafi's adopted daughter.
The agreement paves the way for a full restoration of relations, the opening of a U.S. embassy in Tripoli and a visit by U.S. Secretary of State Condoleezza Rice before the end of the year. It also gives immunity to the Libyan government from any further terror-related lawsuits, the government official said.
Thursday's signing completes a nearly five-year effort to rebuild ties between the two countries.
The U.S. had no diplomatic relations with Libya from 1980 until late 2003, when leader Gadhafi pledged to abandon his weapons of mass destruction programs, stop exporting terrorism and compensate the families of victims of the Lockerbie bombing and other attacks.
After that, the nation that once was a global pariah was given a reprieve from U.N., U.S. and European sanctions, removed from the U.S. State Department's list of state sponsors of terrorism and allowed a seat on the U.N. Security Council.
The last hurdle was over compensation for Americans harmed in Libyan-sponsored attacks, including the Lockerbie attack and the 1986 bombing of La Belle discotheque in Berlin, which killed two American soldiers. The disco attack prompted former U.S. President Ronald Reagan to order the 1986 airstrikes on Libya.
Negotiations began in March 2007. Six rounds of talks were held in several European and Arab capitals, the Libyan government official said.
International institutions and foreign companies operating in Libya - including some American firms - will contribute to a fund to compensate the American and Libyan claimants, he said.
"We went through a long path of negotiations until we reached this agreement," al-Fatouri said just before the signing. "It opens new horizons for relations based on mutual respect. ... "The agreement turns the page on the negative past forever."
The American diplomat, Welch, echoed that sentiment and called the deal a "historic agreement." He also said he delivered a letter from U.S. President George W. Bush to Gadhafi.