Torture claims raise questions over Libya-Britain ties
For years, Libyan and British intelligence were enemies. The legacy of Lockerbie and the supply of Semtex and weapons to the IRA ensured that. But 9/11 - as it did in so many areas - changed the calculus.
At issue was the role of the Libyan Islamic Fighting Group (LIFG) - an Islamist body which opposed Gaddafi and had support networks and members in the UK.
In the 1990s, a blind eye - at the very least - was turned to the LIFG, perhaps on the "my enemy's enemy is my friend" principle.
But after 9/11 the relationship of the LIFG to al-Qaeda meant that it began to be seen as a potential threat.
At the same time, the Gaddafi regime - which had been seeking a way of removing sanctions and improving relations - realised that it had valuable intelligence that the West might want.
That was the makings of, if not a formal deal, then some kind of arrangement. Libyan intelligence officers began to come over to the UK to talk about information sharing soon after 9/11.
On a parallel track, Libya in March 2003 approached MI6 to talk about its weapons of mass destruction - one of MI6's tasks, as well as intelligence collection and liaison, is to conduct clandestine diplomacy and talks on behalf of the government.
Here the motive for Gaddafi was survival.
He was watching the US and UK going to war that very month with Iraq over WMD and feared meeting the same fate.
His son, Saif, met with MI6 officers in an upmarket hotel in Mayfair. Days later, MI6 officer Mark Allen and a colleague travelled to Libya to meet Gaddafi.
He told them their interlocutor would be Moussa Koussa, the head of external intelligence.
Libya thought its nuclear weapons programme was secret. But it had been supplied by the Pakistani AQ Khan, whose supply network had been penetrated by MI6 and the CIA.
As a result, they knew the Libyans were not being frank during the negotiations about what they had.
Eventually, after much difficulty and two trips to Libya by MI6/CIA teams, the Libyans owned up and a deal was done in December 2003.
Mark Allen was among those to conclude the terms at the Travellers Club in Pall Mall and his relationship with Moussa Koussa was solidified - along with that of Steve Kappes, the CIA officer assigned for the negotiations.
With relations improved, the counter-terrorist co-operation which had predated the 2003 WMD deal picked up further pace.
Extensive information sharing is clear from the documents retrieved from Moussa Koussa's office, based on a shared view of the LIFG as a danger.
But just how close did the Libyans and British get?
British intelligence does have to deal with murky regimes, but the question of in what way and with what limits is crucial.
Was there the suspicion that Libya might be torturing people to provide the information that Britain was expecting? If there wasn't, should there have been?
Did Britain, as some of the memos suggest, play a role in LIFG individuals being sent to Libya where they might be mistreated? This would be complicity in rendition - something always strenuously denied.
And were ministers aware of this and did they sign off on these aspects of the relationship?
These are questions which have swirled around British intelligence's relationship with a number of countries - notably Pakistan - for some time.
But in the Libyan case, we can now see original documents and communications which raise serious questions. And some of the very LIFG fighters Britain was worried about are now the ones who have removed Gaddafi's regime from power.
"Clearly in order to protect British citizens we have to work with governments around the world," a spokesperson for the prime minister said on Monday.
"Some of those governments do not share our standards but we need to do what we do to protect us against terrorism."
The issue of what we need to do and how far intelligence agencies need to go has been the source of deep controversy over the last decade. The Libya story may provide one of the most powerful case studies yet to fuel that debate.