The biggest festivity that Libya has ever seen in effect starts tomorrow, as visitors from around the world converge on Tripoli to join the country's mercurial leader, Muammar Gaddafi in celebrating 40 years of absolute rule.
Silvio Berlusconi, Prime Minister of the country that once held Libya as a colony, will be one of the first on to the red carpet. Vladimir Putin, President Nicolas Sarkozy of France, and the King and Queen of Spain are expected, not to mention that elusive alleged war criminal, President Omar al-Bashir of Sudan. A summit of African heads of state will be held on the fringe of the celebrations.
Highlights of the week will include a military parade by contingents from 18 countries, with more than 80 combat, transport and aerobatic planes flying overhead, including Raffle jet fighters from France, and Italy's aerial exhibition team, followed by a late-night spectacular show on a specially constructed 3,000 square metre stage.
But observers here and in the United States, watching on satellite television, will be keeping their eyes out for just one figure amid the sea of famous faces, a sickly man just out of prison.
Col Gaddafi's son, Saif al-Islam, has promised that Abdelbaset Ali al-Megrahi, the man convicted of the Lockerbie bombing, will not be on parade next week. But then, Libya promised that he would not be given a hero's welcome when he returned to Tripoli after being freed from a Scottish prison on compassionate grounds, only to lay on a reception that has caused waves of offence in Britain and the US.
That seems to have been part cock-up and part defiance by the Libyans, who scaled down the reception they had originally planned, and seemed to think it was all rather low key. Beside, Col Gaddafi has said that when Libya repatriated five Bulgarian nurses who had been accused of infecting Libyan children with HIV, they were immediately pardoned, and given an ovation when they appeared in the European Parliament. European politicians say that the difference is that the nurses were innocent, whereas Megrahi is a mass murderer; but Col Gaddafi claims the opposite, and therefore might yet be tempted to put Megrahi on display as an act of defiant bravado.
Although he has ruled Libya with an iron hand for 40 years, Col Gaddafi still needs to consider what the Libyans think of him. Handing Megrahi over to the Scottish authorities for trial looked to his people like an act of weakness. The Libyans have always claimed that Megrahi is an innocent man, a political prisoner, which raises the question why they handed him over to rot in a foreign prison.
But their anxiety to get Megrahi back was not driven simply by an altruistic wish to right an injustice. Megrahi is not just an ordinary Libyan. He was a man with inside knowledge of the murky world of terrorism and political violence, a well-connected former intelligence officer, loyal to the Libyan regime and privy to many of its secrets. In prison, he was making notes with a view to writing a book about his trial and its aftermath. If that book is written, it will pass through Libyan censorship before anyone reads it.
For many years, Megrahi faced the prospect of spending the rest of his active life in high-security Scottish prisons, as the only person to suffer for a crime of which he was not the only perpetrator. While there are divided views in Britain about whether he was implicated in the bombing of Pan-Am 103, what is certain is that if he did it, it was because he was ordered to.
Yet he never turned against his old employers or, so far as we know, threatened to betray any confidence, because he knew that his government was trying to get him back to Libya. Every time that Libyan diplomats have dealt with their counterparts in Britain or the US, the fate of Megrahi was in the back of their minds.
It was 40 years ago on Tuesday that a group of young Libyan army officers led by the 27-year-old Muammar Gaddafi deposed Libya's pro-western king, Idris, and declared Libya a republic. The West's first official reaction was that this need not affect relations with Libya, while King Idris seemed to think it would not last long anyway.
For the next 30 years, Col Gaddafi's regime hurled defiance at the West. He nationalised foreign oil companies, including BP, and was the main driving force behind the sudden hike in oil prices in 1973 that sent the West's economies, and Britain's especially, into recession.
More seriously, he was a paymaster for terrorists across the world. Libya was a source of weapons for the Provisional IRA, and reputedly bankrolled the Venezuelan killer known as Carlos the Jackal. The feared Palestinian terrorist group Abu Nidal set up headquarters in Tripoli, until they were expelled in 1999.
Britain broke off relations with Col Gaddafi's regime after someone opened fire with an automatic weapon on Libyans demonstrating outside the Libyan embassy in London, and killed PC Yvonne Fletcher. In 1986, Libyan was blamed for a bomb that exploded in La Belle disco, Berlin, killing two of the US servicemen who regularly went there. Ronald Reagan ordered air strikes, with the intention of killing Col Gaddafi, which Margaret Thatcher allowed him to launch from UK territory. One bomb killed Col Gaddafi's daughter.
Two years later, on 21 December 1988, the explosion on Pan-Am Flight 103 over Lockerbie killed 270 people. Clothes in the case that held the bomb were traced to a shop in Malta. The shopkeeper identified Megrahi, who was head of security for Libyan Airlines, as the purchaser. In 1991, the US and Scottish authorities charged Megrahi and another man with murder. For eight years, Libya refused to extradite them, for which the United Nations imposed trade sanctions in 1992.
In 1999, after 30 years in power, Gaddafi changed course, and set out on a 10-year campaign to win acceptability and respect from his former enemies. A combination of sanctions, falling oil prices, and poor industrial management had driven his country into prolonged recession, with unemployment at 30 per cent. However, Libya had an important new friend in Nelson Mandela, who wanted Col Gaddafi to be a player in the Organisation for Africa Unity.
In March, Mr Mandela visited Tripoli to make the startling announcement that he had brokered a deal, backed by the Saudi royal family, under which Col Gaddafi would extradite two Lockerbie suspects for trial in the Netherlands, under Scottish law, subject to a set of conditions including the lifting of UN sanctions. A month later, two Libyans, Megrahi and Al Amin Khalifa Fhimah, were handed over to the Scottish authorities in a former US airbase in the Netherlands, which had been designated as Scottish soil for the duration of the trial and any appeal.
The trial, in front of three Scottish judges sitting without a jury, began in May 2000, and dragged on until January 2001, when Fhimah was acquitted, but Megrahi was found guilty and sentenced to life imprisonment, with a recommendation that he spent a minimum of 20 years in prison.
Mr Gaddafi could however congratulate himself on the resumption of diplomatic relations with the UK, broken since 1984, on the lifting of UN sanctions, opening up the prospect of foreign investment, and on keeping the number of Libyans who had to pay the price for all those years that he had dabbled in international terrorism was down to just one.
Even so, seen from Tripoli, it was one too many. Some other major diplomatic move was needed, to start the process of getting Megrahi back.
That turning point came in the wake of the 11 September 2001 attacks. Because while the US had lost more citizens over Lockerbie than any other country, after 9/11 Gaddafi took the Americans by surprise by being one of the first Arab leaders to come out and condemn the perpetrators. He had a self-interested motive, because he was having trouble at home with religious fanatics tenuously linked with al-Qa'ida, but his reasons did not matter so much as his words. The Americans were also impressed that the Libyans were prepared to swap intelligence on Islamist terrorists. Talks with the US now opened in public.
In July 2003, two months after the invasion of Iraq, Col Gaddafi sprang another surprise. He announced that Libya had supplies of uranium, and was on the way to developing an atomic bomb. But his announcement included a hint that, if asked nicely, he might consider renouncing nuclear weapons.
Once again, negotiators beat a path to Tripoli. After months of talks, enlivened by a bit of drama when US and British inspectors raided a German-owned ship docked in an Italian port and seized large quantities of material bound for Libya, a deal was done, and Libya's arms factories were opened to international inspection.
This was a diplomatic tonic for the US and Britain, embarrassed by the absence of any trace of weapons of mass destruction in Iraq. Here, seemingly, was evidence that the invasion of Iraq had produced a result. The timing was so convenient that there are those who suspect that Libya only pretended to have a mass destruction weapons programme so that they could please the Americans by dismantling it. Either way, Libya was off the "Axis of Evil".
Indeed, until last week, Col Gaddafi had been so successful in reinventing himself in the eyes of America that he is scheduled to make his first visit to the US next month, to address the United Nations.
Not so coincidentally, each of the big initiatives in bringing Libya in from the cold has coincided with a development in Megrahi's case. After his conviction, his lawyers lodged an appeal, which took two years to come to a conclusion, so that Scottish judges were being asked to reconsider Megrahi's innocence at the very time when Gaddafi was denouncing al-Qa'ida, and terrorism in all its forms, sending Abu Nidal packing, and talking to the Americans. Unfortunately for Megrahi, it was not enough to convince the judges that they had convicted the wrong man, and Megrahi was sent back to prison.
His lawyers then prepared a case to put before the Scottish Criminal Cases Review Commission, arguing that Megrahi was the victim of a miscarriage of justice. It went in just after Gaddafi had offered to allow international inspection of Libya's weapons facilities, and in the same month that Libya accepted formal responsibility for Lockerbie and agreed to compensate the victims' families.
But the wheels of Scottish justice turn slowly, and the only development in Megrahi's life that year was that he was brought in front a court in Glasgow to be told that his minimum sentence was not 20 years, but 27 years, meaning that he had no hope of release until his 74th birthday, in April 2026.
The next big step in Libya's rehabilitation was the highly publicised visit to the Gaddafi tent, in March 2004, by Tony Blair – the first time a British prime minister had set foot in Libya since Winston Churchill went to cheer up the front-line troops in 1943. The visit was important to the British because it opened the prospect of lucrative trade deals, and to the Libyans because Mr Blair endorsed a Prisoner Transfer Agreement that would allow Libyans sentenced by British courts to be sent back to serve their sentences in Libya, and vice versa.
This raised a new possibility, that even if they could not secure Megrahi's acquittal, or a reduction in his sentence, they could at least get him transferred to custody in Libya. "For the last seven to eight years we have been trying very hard to transfer Mr Megrahi to Libya to serve his sentence here," Saif al-Islam said in an interview in The Herald yesterday.
"We have tried many times in the past to sign the PTA without mentioning Mr Megrahi, but it was obvious we were targeting Mr Megrahi and the PTA was on the table all the time. It was part of the bargaining deal with the UK. When Tony Blair came here we signed the agreement. It is not a secret. But I want to be very clear to your readers that we didn't mention Mr Megrahi. People should not get angry because we were talking about commerce or oil. We signed an oil deal at the same time. The commerce and politics and deals were all with the PTA."
The trade deals followed fast on Mr Blair's visit, including one that brought BP back to Libya, after an absence of more than 30 years, when they signed the company's biggest ever exploration agreement, which would involved sinking 17 exploration wells. There were also ministerial visits, and informal contacts, including an encounter, a week before Megrahi's release, between Peter Mandelson and Saif Gaddafi, which took place in a property on Corfu, owned by the Rothschilds.
It began to looked as if Megrahi's future was not all black. In May 2004, only two months after Mr Blair's visit, Megrahi was given leave to appeal against his sentence. More encouraging still, from the prisoner's point of view, were the spreading doubts in Britain about the guilty verdict.
The civil rights lawyer Geoffrey Robertson QC, and almost everyone in the US who has an opinion on Lockerbie, are convinced of Megrahi's guilt, but Jim Swire, whose daughter died on Pan-Am Flight 103, and the former Labour MP Tam Dalyell are among those convinced that he is innocent. Mr Dalyell and others argue that Libya had no motive to blow up a passenger plane, whereas the Iranian government did. In July 1988, an Iranian airbus was shot down by a US warship, killing 290. At about the same time, German police cracked the Frankfurt cell of an Iranian-backed Palestinian terrorist group, and discovered bomb components similar to those used over Lockerbie. Britain's then Transport Secretary, Paul Channon, privately briefed journalists in March 1989 that the Lockerbie bombers had been traced in Germany and were about to be charged – for which he was later sacked. Mr Dalyell and others suspected that, after the Iraqi invasion of Kuwait in summer 1990, the US and British authorities needed to keep Iran and Syria on-side in the first Gulf War, and therefore conveniently diverted the blame for the Lockerbie outrage on to Libya.
Having spent four years going over the evidence, the SCCRC thought there was sufficient doubt to entitle Megrahi to lodge a second appeal. The hearing got under way in April, and was expected to last a year. Twenty years after the worst terrorist atrocity committed on British soil, the British Government was faced with the unpalatable possibility that the only person convicted of involvement could be declared the victim of a miscarriage of justice – until Megrahi's failing health offered another way out.
But Britain was also under diplomatic pressure to release a man who was regarded in Libya and other parts of the Arab world as a political prisoner. At stake were not just those lucrative oil and construction deals, but the well-being of Britons working in Libya. Although Libya is striving to restore its image, it is still a dictatorship that does not play by the normal rules of diplomacy, where there are powerful politicians who hanker after the old ways of radical confrontation with the West. This was dramatically illustrated in a grubby story involving another of Gaddafi's sons and the Swiss police. In July 2008, Hannibal Gaddafi and his pregnant wife, Aline, visited Geneva, where they were accused of beating their servants. They were arrested, and spent two nights in jail. The Libyan reaction was swift and furious. They imposed trade sanctions, stopped Swiss flights to Tripoli, withdrew billions from Swiss banks, cut deliveries of crude oil that make up half of Switzerland's oil supplies, denied the new Swiss ambassador a visa, and arrested two Swiss citizens whom they accused of breaching immigration regulations, who were told that they could not leave Libya. One, a businessman named Max Goeldi, spent months in the half-empty Swiss embassy, not daring to set foot outside.
Last week, Switzerland's President, Hans-Rudolf Merz, went to Tripoli to deliver a humiliating public apology. A jet plane stood by to take the two trapped Swiss nationals home, but yesterday the plane arrived back in Switzerland, empty.
For British diplomats, it was a warning of the kind of crisis they could face if Megrahi died in Scotland. Libyan opinion was not going to be soothed by anything they were told about palliative care available on the NHS. Indeed, according to the Tripoli Post, "Libyans are now convinced that the Megrahi case could be viewed as a premeditated murder on the part of the Scottish prison authorities" – because he fell ill in prison. If he had died, the prospects for Britons in Libya could have been grim.
The Foreign Office knew this, and knew on the other hand that the Americans would feel betrayed if Megrahi was released. But it was not their decision; it was up to the man in the hot spot, Kenny MacAskill.
To judge by what Mr MacAskill told the Scottish Parliament this week, he would have liked more advice from the UK Government than he got. "They simply informed me that they saw no legal barrier to transfer and that they gave no assurances to the US government at the time," Mr MacAskill said.
If the Foreign Office had wanted Megrahi held in prison, they would have found something else to offer by way of advice. As it was, a local politician whose background is in law was told authoritatively that there was no legal reason why a dying man should have to die in a foreign jail. It can hardly have come as a shock to the Government when he decided to let the man go. The prolonged silence of Gordon Brown and other cabinet ministers, when so many others from President Barack Obama to Iain Gray, leader of the Labour Party in Scotland, are condemning the decision to free Megrahi, is a powerful clue to what the British Government really wanted.