By Gordon Corera
Security correspondent, BBC News
Dr Khan is seen as a hero by many people in Pakistan
The release of Dr Abdul Qadeer Khan will be met with jubilation in much of Pakistan, and an equal measure of alarm in Washington.
While politicians in Washington have liked to portray the scientist as some kind of dark mastermind of nuclear proliferation - former CIA Director George Tenet reportedly referred to him as "at least as dangerous as Osama Bin Laden" - Dr AQ Khan has always been a hero for many Pakistani people.
The reason for his popularity is simple - he is widely seen as having made Pakistan a nuclear state and delivered it a form of status and security that the country otherwise would profoundly lack.
The reason for his notoriety is the belief that he also secretly helped other countries to develop their nuclear programmes.
Dr Khan came to Europe in the 1970s as a young scientist and found work at a subcontractor to Europe's nuclear enrichment programme which ran centrifuges to make nuclear fuel - the same devices can also be used to enrich uranium for a nuclear weapon.
But at the same time his native Pakistan was going through a crisis, first defeated by India in a 1971 war and then watching India test a "peaceful" nuclear explosive in 1974.
Dr Khan realised he had access to highly sensitive nuclear technology and wrote to Pakistan's then leader, Zulfiqar Ali Bhutto, offering his assistance.
He returned home to build a remarkable network of suppliers - largely European businessmen - who would send the highly sensitive parts to Pakistan where Dr Khan could build his own enrichment plant at Kahuta.
Developing centrifuges is an incredibly complex technical task - as Iran has found in recent years - but by the early 1980s, Kahuta was producing enriched uranium for Pakistan's weapons.
Those weapons were not tested until 1998 - in response to India's test - and the detonation of a nuclear device helped cement Dr Khan's reputation as the "father of the bomb".
Pakistan began testing weapons in response to India's nuclear programme
Around that same time, the CIA and Britain's Secret Intelligence Service MI6 began to see signs indicating that Dr Khan was doing much more than build Pakistan's own bomb but was also engaged in passing on the highly sensitive nuclear secrets to other countries, including Iran, North Korea and Libya.
It was the deal with Libya which in the end would bring his work to a halt.
In 2003, an intermediary of Libya's Colonel Gaddafi approached MI6 offering to begin negotiations to bring in Libya from the cold.
Eventually, Libya came clean about its secret nuclear weapons programme and in doing so revealed the full extent of the Khan network's activities.
Among the items handed over by Libyan officials was a bag from a Pakistan tailors containing design information for a nuclear weapon.
In turn, this information was then used to confront President Pervez Musharraf of Pakistan and force him to act against the scientist.
In February 2004, Dr Khan went on Pakistan national television and confessed to "unauthorised proliferation activities".
He was promptly placed under house arrest. His lawyers began to challenge the detention and in a spate of interviews in 2008, he also said that the confession had been false.
Some claimed Khan was driven by greed or money, but in fact he seems to have been motivated by a desire to break the nuclear monopoly of the West.
Mr Musharraf's departure from office paved the way for Dr Khan's release
It has also been disputed how far he was operating independently and how far with the connivance of the Pakistani state.
There is no doubt that many senior military figures were at the very least aware of Dr Khan's activities and their reluctance to have this information become public was widely seen as one reason why he was placed under house arrest with even the CIA not being provided direct access to ask him questions.
The departure of the military government and of Mr Musharraf has paved the way for his eventual release.
Many questions remain unanswered about his activities though, including what exactly he gave to whom.
Even last year there were reports that his network may have been had copies of a far more advanced nuclear weapons design than previously understood.
And in January, just weeks before his release, the US State Department sanctioned 13 individuals and companies for involvement with Dr Khan, saying they hoped the move would "help prevent future proliferation activities".
So, whilst AQ Khan will be celebrating his release, Washington will be watching very closely.