For four decades the wilful, mercurial figure of Colonel Muammar Gaddafi ruled Libya with an iron grip while remaining a persistent thorn in the side of the West.
Branded "mad dog" by Ronald Reagan, the outlandish antics, flamboyant dress and bombastic pronouncements of the self-styled "Brother Leader" made him a figure of ridicule at times.
During his travels abroad he was accompanied by a blonde Ukrainian nurse and insisted on staying in his Bedouin tent, protected by his team of glamorous, gun-toting female bodyguards.
When he was interviewed by the BBC's John Simpson, he noisily broke wind throughout their encounter.
But he has also been associated with some of the most notorious terrorist atrocities of the pre-9/11 era.
He shipped arms to the IRA during the Troubles in Northern Ireland and his regime has accepted responsibility for the Lockerbie bombing.
At home in Libya he ruthlessly crushed dissent against his autocratic rule while his agents hunted down and killed opponents abroad.
When his people - inspired by the the Arab Spring - finally rose up against him earlier this year, he responded with a characteristic mixture of bluster and brutality calling for the "devils" to be cleansed.
But for all the outrage over his flouting of international norms, he was also seen by diplomats as a wily political operator, proving to be one of the great survivors in a turbulent region.
Through assassination attempts, sanctions and US airstrikes, he doggedly clung to power.
Born in the desert in 1942, at 27 years old Gaddafi became the leader of a small group of junior army officers who in September 1969 staged a bloodless coup, overthrowing King Idris while he was abroad receiving medical treatment.
Fiercely anti-western and inspired by Egypt's President Nasser, he governed according to his unique political philosophy - set out in his Green Book - based on a combination of socialism and Arab nationalism.
He quickly showed he would brook no dissent to his idiosyncratic rule, reportedly having students who marched against his regime publicly hanged.
In one of his most infamous atrocities, 1,200 prisoners were massacred in Tripoli's Abu Salim jail in 1996.
Abroad, his outspoken public support for a range of terrorist organisations, including the IRA and the Palestine Liberation Organisation, attracted growing international criticism and concern.
The increasingly erratic nature of his regime was underlined in 1984 when diplomats at the Libyan embassy in London opened fire on a demonstration outside, killing WPc Yvonne Fletcher.
In 1986, the bombing by Libyan agents of a Berlin nightclub, in which two off-duty American servicemen died, prompted President Reagan to launch airstrikes on Tripoli and Benghazi. Gaddafi's adopted daughter was among 35 Libyans killed in the raid.
Two years later, on December 21 1988, came the most notorious incident of all - the bombing of Pan Am Flight 103 over the Scottish village of Lockerbie, killing 270 people.
The attack prompted worldwide outrage. For years Gaddafi denied any involvement, leading to sanctions by the United Nations and international pariah status for his regime.
He finally began to emerge from the cold when South African president Nelson Mandela helped to broker a deal which saw two Libyan intelligence officers handed over in 1999 to stand trial before a Scottish court sitting in the Netherlands.
In 2003, after one of the men had been convicted, the Libyan government wrote to the UN Security Council formally accepting responsibility for the actions of its officials in respect of the attacks.
Gaddafi's rehabilitation seemed complete when the same year, following the overthrow of Saddam Hussein by US and British forces, he admitted that Libya had an active weapons of mass destruction programme which he offered to dismantle.
In 2004, Tony Blair travelled to Tripoli to welcome the West's new ally in the so-called "War on Terror".
Despite his new-found respectability, Gaddafi soon showed that he had lost none of his capacity to outrage.
There was fury in Britain and the US in 2009 when the man convicted of the Lockerbie bombing, Abdelbaset al-Megrahi, was given a hero's welcome on his return to Tripoli after his release from a Scottish prison on compassionate grounds.
At his first appearance at the UN General Assembly, Gaddafi tore up a copy of the UN charter, likened the Security Council to al Qaida, and demanded 7.7 trillion dollars in compensation to Africa from its former colonial rulers.
During an official visit to Italy, he courted further controversy when he paid a modelling agency to find 200 young Italian women to attend a lecture he gave urging them to convert to Islam.
When, in February this year, his own people rose up against him, and he responded with brutal repression, any lingering international approbation swiftly vanished and his isolation was complete.