TRIPOLI, Libya (AP) -- In flowing brown Bedouin robes and black beret, hailed as the "king of kings of Africa," the aging dictator swept up onto the global stage, center front at the United Nations, and delivered an angry, wandering, at times incoherent diatribe against all he detested in the world.
In that first and only appearance before the U.N. General Assembly, in 2009, Moammar Gadhafi rambled on about jet lag and swine flu, about the John F. Kennedy assassination and about moving the U.N. to Libya, the vast desert nation he had ruled for four decades with an iron hand.
As dismayed U.N. delegates streamed out of the great domed hall that autumn day, a fuming Gadhafi declared their Security Council "should be called the `Terror Council,'" and tore up a copy of the U.N. charter.
The bizarre, 96-minute rant by Libya's "Brother Leader and Guide of the Revolution" may now stand as a fitting denouement to a bizarre life, coming less than two years before Gadhafi's people rose up against him, before some in that U.N. audience turned their warplanes on him, before lieutenants abandoned him one by one, including the very General Assembly president, fellow Libyan Ali Treki, who in 2009 glowingly welcomed his "king" to the New York podium.
As rebels swarmed into Tripoli late Sunday and his son and one-time heir apparent Seif al-Islam was arrested, Gadhafi's rule was all but over, even though some loyalists continued to resist.
More than any of the region's autocratic leaders, perhaps, Gadhafi was a man of contrasts.
He was a sponsor of terrorism who condemned the Sept. 11 attacks. He was a brutal dictator who bulldozed a jail wall to free political prisoners. He was an Arab nationalist who derided the Arab League. And in the crowning paradox, he preached people power, only to have his people take to the streets and take up arms in rebellion.
For much of a life marked by tumult, eccentricities and spasms of violence, the only constants were his grip on power - never openly challenged until the last months of his rule - and the hostility of the West, which branded him a terrorist long before Osama bin Laden emerged.
The secret of his success and longevity lay in the vast oil reserves under his North African desert republic, and in his capacity for drastic changes of course when necessary.
One spectacular series of U-turns came in late 2003. After years of denial, Gadhafi's Libya acknowledged responsibility for the 1988 bombing of a Pan Am jumbo jet over Lockerbie, Scotland, that killed 270 people. Libya agreed to pay up to $10 million to relatives of each of the victims, and declared it would dismantle all of its weapons of mass destruction.
The rewards came fast. Within months, the U.S. lifted economic sanctions and resumed low-level diplomatic ties. The European Union hosted Gadhafi in Brussels. Tony Blair, as British prime minister, visited him in Tripoli, even though Britain had more reason than most to detest and fear him.
Then, in February, amid a series of anti-government uprisings that swept the Arab world, Gadhafi unleashed a vicious crackdown on Libyans who rose up against him. Libyan rebels defied withering fire from government troops and pro-Gadhafi militia to quickly turn a protest movement into a rebellion.
Just days after the uprising against him began, Gadhafi delivered one of his trademark rants on Feb. 22 from his Tripoli compound, which was bombed by U.S. airstrikes in the 1980s and was left unrepaired as an anti-American display.
Pounding a lectern near a sculpture of a golden fist crushing a U.S. warplane, he vowed to hunt down protesters "inch by inch, room by room, home by home, alleyway by alleyway." The televised speech caused a furor that helped fuel the armed rebellion against him and it has been since mocked in popular songs and spoofs across the Arab world.
In March, the U.N. authorized a no-fly zone for Libya and "all necessary measures" to prevent Gadhafi from attacking his own protesting people. NATO airstrikes followed against Libyan military targets and included one attack that killed Gadhafi's youngest son on April 30.
Gadhafi was born in 1942 in the central Libyan desert, the son of a Bedouin father who was once jailed for opposing Libya's Italian colonialists. The young Gadhafi seemed to inherit that rebellious nature, being expelled from high school for leading a demonstration, and disciplined while in the army for organizing revolutionary cells.
In 1969, as a mere 27-year-old captain, he emerged as leader of a group of officers who overthrew King Idris' monarchy. A handsome, dashing figure in uniform and sunglasses, he took undisputed power and became a symbol of anti-Western defiance in a Third World recently liberated from its European colonial rulers.
During the 1970s, Gadhafi embarked on far-reaching reforms.
A U.S. air base was closed. Some 20,000 Italians were expelled in retaliation for the 1911-41 occupation. Businesses were nationalized. Gadhafi proclaimed a "popular revolution" and began imposing "peoples' committees" as local levels of government, topped by a "Peoples' Congress," a kind of parliament. He declared Libya to be a "Jamahiriya" - a word connoting "republic of the masses."
He led a state without a constitution, instead using his own idiosyncratic book of political philosophy - the "Green Book." He took the military's highest rank, colonel, when he came to power and called himself the "Brother Leader" of the revolution.
"He aspired to create an ideal state," said North African analyst Saad Djebbar of Cambridge University. "He ended up without any components of a normal state. The 'people's power' was the most useless system in the world, turning revolutionaries into a force of wealth-accumulators."
Like many dictators intent on ensuring they have no rivals, Gadhafi had no clear system of succession. But he was believed to be grooming his British-educated son, Seif al-Islam, to succeed him. Now that son is under arrest and, like his father, wanted by the International Criminal Court in the Netherlands for crimes against humanity during the bloody crackdown on dissenters.
Gadhafi took pleasure in saying out loud what other leaders would only think, frequently berating the Arab League for its inability to act in the Israeli-Palestinian and Iraqi conflicts.
But while he enjoyed speaking out on the world stage, he did not tolerate people speaking out in Libya. His government allowed no organized opposition.
In 1988, he declared he was releasing political detainees and drove a bulldozer through the wall of a Tripoli prison. But in reality his regime remained totalitarian.
Gadhafi did spend oil revenue on building schools, hospitals, irrigation systems and housing on a scale his Mediterranean nation had never seen.
"He did really bring Libya from being one of the most backward and poorest countries in Africa to becoming an oil-rich state with an elaborate infrastructure and with reasonable access by the Libyan population to the essential services they required," said George Joffe of Cambridge University.
But although Libya was producing almost 1.6 million barrels of crude per day before the civil war, about a third of its roughly 6 million people remain in poverty. Gadhafi showered benefits on parts of the country, such as the capital Tripoli. Meanwhile, eastern Libya, ultimately the source of February's rebellion, was allowed to atrophy.
In the 1970s and 1980s, Gadhafi increasingly supported groups deemed terrorist in the West - from the Irish Republican Army to radical Palestinians and militant groups in the Philippines.
A 1984 incident at the Libyan Embassy in London entrenched his regime's image as a lawless one. A gunman inside the embassy opened fire on a demonstration by anti-Gadhafi demonstrators outside, killing a British policewoman.
The heat had been rising, meanwhile, between the Reagan administration and Gadhafi over terrorism. In 1986, Libya was found responsible for a bombing at a Berlin discotheque frequented by U.S. troops in which three people died. America struck back by sending warplanes to bomb Libya. About 40 Libyans were killed, including Gadhafi's adopted baby daughter.
In 1988, a Libyan agent planted the bomb that blew up Pan Am Flight 103 over Lockerbie. The next year, another Libyan set a bomb that blew up a French airliner over Niger in west Africa.
The West was outraged, and years of sanctions followed.
Joffe said Gadhafi's involvement in terrorism was the "major mistake" of his career.
"Whoever was directly responsible for (the 1988 and 1989 attacks), the consequence was that Libya found itself isolated in the international community for almost a decade and, in that isolation, it suffered considerable economic loss."
During the same period, Gadhafi embarked on a series of military adventures in Africa, invading Chad in 1980-89, and supplying arms, training and finance to rebels in Liberia, Uganda and Burkina Faso.
In 2002, Gadhafi looked back on his actions and told a crowd of Libyans in the southern city of Sibha: "In the old days, they called us a rogue state. They were right in accusing us of that. In the old days, we had a revolutionary behavior."
His first outward signal of change came in 1999, when his government handed over for trial two Libyans charged with the Lockerbie bombing. In 2001, a Scottish court convicted one, an intelligence agent, and sentenced him to life imprisonment. The other was acquitted.
Libyan officials denied the government was involved. But in August 2003, 20 months later, Libya accepted state responsibility in a letter to the U.N. It had also apologized for the London policewoman's murder, allowing it and Britain to renew diplomatic ties, and the Security Council lifted its sanctions.
A bigger surprise came in December 2003 when Britain's Blair announced that Gadhafi had acknowledged trying to develop weapons of mass destruction but had decided to dismantle the programs under international inspection.
What caused Gadhafi's turnaround is debatable. Some maintained he was afraid his regime would be toppled like the Taliban in Afghanistan and Saddam Hussein in Iraq. But Djebbar and Joffe both say negotiations on weapons of mass destruction had begun even before 9/11.
Gadhafi wanted sanctions lifted and an end to American hostility to ensure his regime's survival, Joffe said. In 2006 the Bush administration rescinded its designation of Libya as a state sponsor of terrorism.
By early 2011, however, as Tripoli responded violently to anti-government protests, U.S. and other sanctions were being reimposed on Libya's leaders and Gadhafi family members, among them his wife, Safia, and several of their eight children, including sons Hannibal, head of Libya's maritime transport company; Saadi, special forces commander and Libya's soccer federation head, and Mohammed, Libya's Olympic chief.
Gadhafi said he met Safia, then a teenage nursing student, while recuperating from an appendectomy after taking power in 1969. He soon divorced his first wife and remarried. Their only daughter, Aisha, became a lawyer and helped in the defense of Saddam Hussein, Iraq's toppled dictator, in the trial that led to his hanging.
Gadhafi's flamboyance and eccentric lifestyle were always the subject of lampooning in America and elsewhere.
He had a personal escort known as the Amazonian guard - young women said to be martial-arts experts who often carried machine guns and wore military-style uniforms with matching camouflaged headscarves.
A 2009 U.S. diplomatic cable released by the website WikiLeaks cited Gadhafi's heavy reliance on a Ukrainian nurse - described as a "voluptuous blonde" - and his intense dislike of staying on upper floors of buildings, aversion to flying over water, and taste for horse racing and flamenco dancing.
He donned garish military uniforms with braids and huge, fringed epaulettes, or colorful Bedouin robes and African-patterned clothing, along with sunglasses and fly whisks. His hair grew scruffy and he sported a goatee and scraggly mustache.
In his first televised appearance after protests broke out in Libya, he appeared with an umbrella and a cap with earflaps. Four months later, dodging NATO bombs in Tripoli, addressing loyalists by telephone from a hidden location on June 17, Gadhafi sounded defiant still, the old "Brother Leader," but hoarse, agitated, embattled - and perhaps seeing the end.
"We don't care much for life," he declared. "We will not betray the past and the sacrifices, or the future. We will carry out our duty until the end."