By Jonathan Marcus
BBC diplomatic correspondent
If diplomats wrote fairy stories, this would probably be one.
Libya's ending of weapons programmes led to the breakthrough
Once seen in Washington as a typical "rogue state", Libya has now definitively come in from the cold.
By anyone's standards it is a diplomatic happy ending.
The big breakthrough came at the end of 2003 when the US and British governments announced that the Libyan authorities - after months of secret negotiations - had agreed to disclose and dismantle their nuclear, chemical and biological weapons programmes.
During the preceding months, the Libyan authorities had gradually agreed to take some responsibility for the bombing of a Pan Am airliner over Lockerbie in 1988; a compensation agreement was reached with the families of the victims; and a similar deal was agreed with the families of those killed in the bombing of a French UTA airliner in 1989.
All this prompted the lifting of United Nations sanctions.
But the normalisation of ties with Washington has proceeded at a slower, step-by-step pace.
Direct Libya-US diplomatic ties were restored in June 2004 with the opening of an American liaison office in Tripoli.
But it has taken almost two more years for the Bush administration to be satisfied - as one official put it - that Libya "is out of the terrorism business". Indeed the Americans now praise the Libyans for their co-operation in the counter-terrorism field.
1980: US ends diplomatic ties with Libya
1986: Libya blamed for killing US troops in Berlin disco bomb
1986: US jets bomb Libyan capital and military bases
1988: Pan Am jet explodes over Lockerbie; Libya blamed
1999: Libya hands over Lockerbie bomb suspects
2003: Libya says it will give up WMDs and long-range missiles
2006: US says it will restore full diplomatic ties with Libya
So a country once condemned for its involvement in international terrorism and for having clandestine weapons programmes has been cajoled and encouraged back into the international fold.
The question now is whether the Libyan experience has any broader lessons.
The US Assistant Secretary of State, David Welch, certainly thinks so.
He explicitly cited Libya as an important model as Washington pushes for change in the policy of other countries, notably Iran and North Korea.
Every situation is of course different. But the Libyan experience shows what can be done through negotiation when there is goodwill on both sides.
This news will only bolster those in Washington - in the think-tanks and on Capitol Hill - who argue that the Bush administration should be more willing to explore whether direct talks with Tehran are possible.
Iran put out feelers concerning potential talks back in 2003
That was at a time when US forces had occupied much of both Afghanistan and Iraq and the Iranians felt under huge pressure. Their overture was rebuffed.
Today Iran feels that the regional strategic balance has to some extent shifted in its favour.
The Iranian President Mahmoud Ahmadinejad's curious letter to President Bush notwithstanding, there seems little sign at the moment of a desire in Tehran for a wide-ranging dialogue with Washington.
Equally, the Bush administration too seems to have set itself against pursuing such contacts.
Nonetheless the experience with Libya shows that seemingly intractable problems can be grappled with by diplomatic means.
But bear in mind one distinctive feature of the 2003 Libya talks, in which British officials played a prominent role.
They went on for months in total secrecy. If you want diplomatic happy endings, then megaphone diplomacy and the glare of the media spotlight probably have to take a back seat.