Muammar Gaddafi's love of comic-opera uniforms, exotic female bodyguards and Bedouin tents provided a theatrical backdrop for 42 years of bloody repression that in the end could not withstand a determined uprising backed by Nato air power.
Chased out of Tripoli when rebel forces took the capital last month, Gaddafi disappeared, some said into the empty desert spaces in the south of his vast country.
But on Thursday, senior figures in Libya's interim National transitional Council announced that the man who had ruled their country was dead, shot in chaotic circumstances in the custody of former rebels who had taken his home town, Sirte, the last stronghold of fighters still loyal to the ancien regime.
Gaddafi had always declared that he would fight to the end in his homeland and that is what he did.
In tandem with his eccentricity, Gaddafi had a charisma which initially at least won him support among many ordinary Libyans. His readiness to take on Western powers and Israel, both with rhetoric and action, earned him a certain cachet with some in other Arab states who felt their own leaders were too supine.
While leaders of neighbouring Arab states folded quickly in the face of popular uprisings this year, Gaddafi put up a bloody fight, taking on Nato as well as local insurgents who quickly seized half the country.
For most of his 42-year rule, he held a prominent position in the West's gallery of international rogues, while maintaining tight control at home by eliminating dissidents and refusing to anoint a successor.
One of his secret agents was convicted of the 1988 Lockerbie airliner bombing in which 270 people, many of them Americans, were killed.
Gaddafi later effected a successful rapprochement with the West by renouncing his weapons of mass destruction programme in return for an end to sanctions. But he could not avoid the tide of popular revolution sweeping through the Arab world.
In retrospect, his time had come when he turned his guns on protesters and sent his army to cleanse Benghazi, prompting Western powers and Nato to open up a campaign of aerial bombing that allowed rebel forces eventually to oust him.
The Libyan leader, his son and his spy chief are wanted for crimes against humanity by the International Criminal Court in The Hague for planning the violent suppression of the uprising that began in the east of the country.
As his oil-producing North African desert country descended into civil war, Gaddafi's military responded with the deadly force that he had never been afraid to use, despite the showman image that captivated many abroad.
When the insurgency began in mid-February, protesters were gunned down in their hundreds. As his troops advanced on Benghazi he famously warned rebels there would be "no mercy, no pity". They would be hunted down "alley by alley, house by house, room by room".
Those words may have been his undoing. Days later the United Nations passed a resolution clearing the way for a Nato air campaign that knocked out his air force, tanks and heavy guns.
Raids also targeted his own headquarters in Tripoli. One raid killed his youngest son and three grandchildren.
US President Ronald Reagan called Gaddafi a "mad dog" and sent warplanes to bomb his Bab al-Aziziyah compound in 1986, after the bombing of a West Berlin discotheque he blamed on Libyan agents.
Gaddafi used the Tripoli building bombed in the raid, left unrepaired for 25 years, to deliver one of his first defiant speeches of the war, standing beside a memorial in the shape of a giant metal fist crushing an American warplane.
This week, the interim government sent bulldozers in to start levelling the compound.
In televised addresses in response to the rebellion in the east earlier this year, Gaddafi blamed the unrest on rats and mercenaries and said they were brainwashed by Osama bin Laden and under the influence of hallucinogenic drugs used to spike their coffee.
As the weeks passed, there was repeated speculation that Gaddafi has either been killed or wounded in Nato air raids, but he made carefully choreographed television appearances in response to the rumours.
In May, Gaddafi taunted Nato, saying its bombers could not find him.
"I am telling the coward crusaders that I am at a place you cannot reach and kill me," he said in a broadcast audio recording. His later speeches during the summer were also delivered as audio recordings, presumably to conceal his whereabouts.
"I will die here"
"I am not going to leave this land, I will die here as a martyr ... I shall remain here defiant," he said in one broadcast.
One of the world's longest serving national leaders, Gaddafi had no official government function and was known as the "Brother Leader and Guide of the Revolution".
He strove for influence in Africa, showering his poorer neighbours with the largesse that Libya's vast oil wealth allowed and styling himself the continent's "King of Kings".
His love of grand gestures was on display on foreign visits when he slept in a Bedouin tent guarded by dozens of female bodyguards.
In Italy last year, Gaddafi's invitation to hundreds of young women to convert to Islam overshadowed the visit, which was intended to cement growing ties between Tripoli and Rome.
US diplomatic cables released by the WikiLeaks website shed further light on the Libyan leader's tastes.
One cable posted by The New York Times describes Gaddafi's insistence on staying on the ground floor when he visited New York for a 2009 meeting at the United Nations and his reported refusal or inability to climb more than 35 steps.
Gaddafi was also said to rely heavily on his staff of four Ukrainian nurses, including one woman described as a "voluptuous blonde". The cable speculated about a romantic relationship, but the nurse, Galyna Kolonytska, 38, fled Libya after the fighting started.
Gaddafi was born in 1942, the son of a Bedouin herdsman, in a tent near Sirte on the Mediterranean coast. He abandoned a geography course at university for a military career that included a short spell at a British army signals school.
Colonel Gaddafi took power in a bloodless military coup in 1969 when he toppled King Idriss, and in the 1970s he formulated his "Third Universal Theory", a middle road between communism and capitalism, as laid out in his "Green Book".
Oil wells and desert
Gaddafi oversaw the rapid development of Libya, which was previously known for little more than oil wells and deserts where huge tank battles took place in World War Two.
The economy is now paying the price of war and sanctions.
One of his first tasks on taking power was to build up the armed forces, but he also spent billions of dollars of oil income on improving living standards, making him popular with the low-paid.
Gaddafi poured money into giant projects such as a steel plant in the town of Misrata -- the scene of bitter fighting -- and the Great Man-Made River, a scheme to pipe water from desert wells to coastal communities.
Gaddafi embraced the pan-Arabism of the late Egyptian leader Gamal Abdel Nasser and tried without success to merge Libya, Egypt and Syria into a federation. A similar attempt to join Libya and Tunisia ended in acrimony.
In 1977 he changed the country's name to the Great Socialist Popular Libyan Arab Jamahiriyah (State of the Masses) and allowed people to air their views at people's congresses.
However, for much of his rule he has been shunned by the West, which accused him of links to terrorism and revolutionary movements.
He was particularly reviled after the 1988 Pan Am airliner bombing over Lockerbie, Scotland, by Libyan agents.