In 2006, the US removed Libya from its list of state sponsors of terrorism. Some say Mr Gaddafi feared Libya might face the wrath of the US in the wake of the attacks of 11 September 2001, or perhaps he saw an opportunity.
"I think people in Libya saw that the way they were pursuing their national interest was not going to work for them. It was costing them a very high price for their country," David Welch, Assistant Secretary of State for Near Eastern affairs, told the BBC in an interview.
"When they decided they didn't want to have WMDs anymore, President Bush and Prime Minister Blair acknowledged it in a very public fashion."
But even with Tripoli's change in behaviour and the lifting of US and UN sanctions on the country, a main sticking point remained - compensation for the families of victims of attacks linked to Libya.
Tripoli paid most of the money for the Lockerbie victims ($10m per family) but held out on the last instalment of $2m - in part because it was frustrated it was not getting more economic and political benefits out of Washington.
Interview with Saif al-Islam, in which he called the families of the disaster greedy
Finally, this month, a groundbreaking deal was negotiated by Mr Welch to set up an international compensation fund and to restore sovereign immunity for Libya, ending all pending lawsuits against Tripoli in US courts.
The fund will be set up in Libya to compensate all American and Libyan claimants - this would include relatives of the victims of the US bombing of Tripoli and Benghazi in 1986, which came in retaliation for a previous attack in Berlin against US citizens.
This is what paved the way for Condoleezza Rice's visit, something Mr Gaddafi has wanted to see happen for some time.
Relatives of the victims say they are disappointed that Ms Rice's trip was announced before Libya had deposited the money into the fund.
In a recent interview with the BBC, the Libyan leader's son, Saif al-Islam described the families as greedy and seemed to indicate the decision to pay compensation had been a clear and perhaps cold calculation.
"Everything was clear in the UN Security Council resolution. Libya should do certain steps in order to get rid of the sanctions. That's why we abide by the rules of the game," said the younger Gaddafi.
"The Americans and the British said you have to satisfy the families and we will lift the sanctions."
Most of the relatives see no remorse in the Libyan leader's moves, just tactics, but they felt that compensation was a necessary part of Libya's rehabilitation.
"It requires a particular person in each of those countries to make the decision that they want to settle," said Glen Johnson, chairman of Victims of Pan Am Flight 103 and the father of 21-year-old Beth-Ann who died on the flight.
"Libya I think surprised a lot of people by agreeing to do this and I think anytime you can do that a lot of lives can be saved."
Attorney James Kreindler, who represented 120 of the Lockerbie families and is also representing families suing Iran and Sudan for other attacks, believes there are lessons to be learned from the 20 year-long lawsuit.
What we achieved with Libya is a road map
James Kreindler Attorney
"One of the lessons is that taking a responsible position in resolving legitimate international lawsuits can be an important step in normalising relations between countries that had not enjoyed normal relations," he said.
"What we achieved with Libya is a road map. Everyone wants to see a safer world where countries are not sponsoring terrorism and this could be a piece of that puzzle."
Having neutralised one past bitter enemy, can the US now replicate what it sees as a diplomatic success with other countries, like Iran?
"In Tehran they should be sitting in their offices and conducting an assessment of whether their policies are paying off or not," said Mr Welch adding that Libya, its economy and oil producers would benefit greatly from the full resumption of US-Libyan ties, while Iran's economy was "woefully mismanaged".
"The Iranian national leadership has chosen to take a path that will cost the country more each day. We hope they wake up."
But Mr Welch and foreign policy experts are aware that Iran is very different from Libya.
"Libya was relatively easy because the issues were relatively neat and didn't resonate in the same way in the United States. Iran is not in that category," said Jon Alterman, Middle East director of the Center for Strategic and International Studies (CSIS).
Although it was still actively pursuing WMDs up until the moment it changed tack, Libya had for a while already stopped supporting militant groups, making it easier for the US to deal with one issue at a time.
"If you look at Iran, it's actively involved in terrorism, it's undermining any sort of Arab-Israeli peace deal, it's helping kill American soldiers in Iraq and is actively pursuing a nuclear weapon.
"Which one of these issues are you willing to ignore while dealing with one of the other issues, one by one?"
Today Libya feels that it has made the right choice.
"We were very wise, now we are a safe country… we are trading now with our ex-enemies, we just have friends, no enemies anymore, no embargo, no sanctions, no threat," said Saif al Islam.
But Tripoli may be disappointed in its long term relationship with Washington.
"Libya is still not a strategic consideration for the United States, although reversing its hostile relationship with the United States was the most strategic decision taken by Libya," said Mr Alterman.
Muammar Gaddafi, ever the shrewd politician, may already have picked up on that when he said this week that his country did not want to be friends with the US, it just wanted to be left alone.
The Iranians may be watching to see how this relationship develops and assess what they could get out of Washington if they ever decide to go down the same route.
Although, with a much more strategic role in the region, Tehran will be driving a tougher bargain and a much longer, more complex process, whenever it really kicks off.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.