TRIPOLI, Libya (AP) -- During nearly 42 years in power, Moammar Gadhafi ruled with an eccentric brutality. He was so mercurial he turned Libya into an isolated pariah, then an oil power courted by the West, then back again. At home, his whims became law and his visions became a warped dictatorship, until he was finally toppled by his own people.
The modern Middle East's longest-reigning figure, Libya's 69-year-old "Brother Leader" became the first ruler killed in the Arab Spring uprisings that swept the region this year.
After rebels overwhelmed the capital Tripoli and drove him into hiding in late August, Gadhafi vowed in messages to fight on until "martyrdom or victory" and to "burn Libya under the feet" of his enemies. And indeed, he met his end Thursday alongside his last heavily armed supporters, cornered by revolutionary fighters in Sirte, the fishing village where he was born and which he transformed during his rule into a virtual second capital city.
In the last images of him alive, a wounded Gadhafi staggered and shouted at fighters dragging him away after pulling him out of a drainage tunnel where he took refuge trying to flee Sirte with loyalists. His goateed face was bloodied, his head balding after the loss of the hairpiece that filled out his trademark bush of curly hair.
"What do you want? Don't kill me, my sons," Gadhafi said to the fighters as they grabbed him, one commander said.
Gadhafi leaves behind an oil-rich nation of 6 million traumatized by a rule that drained it of institutions after four decades when all issues came down to one man and his family. Notorious for his extravagant outfits - ranging from white suits and sunglasses to military uniforms with frilled epaulets to brilliantly colored robes decorated with the map of Africa - he styled himself as a combination Bedouin chief and philosopher king, with titles from "leader of the revolution" to "king of the kings of Africa."
He ruled by mad lurches. He was a sponsor of terrorism whose regime was blamed for blowing up two passenger jets and who then helped the U.S. in the war on terror. He was an Arab nationalist who mocked Arab rulers. He seemed to revel in infuriating leaders, whether in the West or the Middle East.
U.S. President Ronald Reagan branded him a "mad dog" after a 1986 bombing that killed U.S. servicemen in Berlin was blamed on Libya. Former Egyptian President Anwar Sadat, who fought a border war with Libya in the 1970s, wrote in his diary that Gadhafi was "mentally sick" and "needs treatment."
Behind the flamboyance and showmanship, associates say Gadhafi was meticulous in managing the levers of power. He intervened in decisions large and small and constantly met personally with tribal leaders and military officers whose support he maintained through lucrative posts.
The sole constant was his grip on the country. Numerous coup and assassination attempts against him over the years mostly ended with public executions of the plotters, hanged in city squares.
The ultimate secret of his longevity lay in the vast oil reserves under his North African desert nation and in his capacity for drastic changes of course when necessary.
The most spectacular U-turn came in late 2003. After years of denial, Libya acknowledged responsibility - though in a Gadhafi-esque twist of logic, not guilt - for the 1988 bombing of Pan Am Flight 103 over Lockerbie, Scotland, that killed 270 people. He agreed to pay up to $10 million to relatives of each victim.
He also announced that Libya would dismantle its nuclear, chemical and biological weapons programs under international supervision.
The rewards came fast. Within months, the U.S. lifted economic sanctions and resumed diplomatic ties. The European Union hosted Gadhafi in Brussels. Secretary of State Condoleezza Rice in 2008 became the highest-ranking U.S. official to visit the country in more than 50 years. Rice had a special place in the heart for Gadhafi, who in an interview once called her "my darling black African woman ... I love her very much ... Leezza, Leezza, Leezza." Tony Blair, as British prime minister, also visited him in Tripoli.
International oil companies rushed to invest in Libya's fields. Documents uncovered after Gadhafi's fall revealed close cooperation between his intelligence services and the CIA in pursuing terror suspects after the 9/11 attacks, even before the U.S. lifted its designation of Libya as a sponsor of terror in 2006.
Still, Gadhafi's renegade ways did not change. After Swiss police had the temerity to briefly arrest his son Hannibal for allegedly beating up two servants in a Geneva luxury hotel in 2008, Gadhafi's regime arrested two Swiss nationals and raked Switzerland over the coals, extracting an apology and compensation before finally releasing the men nearly two years later. European countries, eagerly building economic ties with Libya, did little to back up Switzerland in the dispute.
But Gadhafi became an instant pariah once more when he began a brutal crackdown on the February uprising in his country that grew out of the "Arab Spring" of popular revolts across the region. The U.N. authorized a no-fly zone for Libya in March, and NATO launched a campaign of airstrikes against his military forces.
"I am a fighter, a revolutionary from tents. ... I will die as a martyr at the end," he proclaimed in one of his last televised speeches during the uprising, pounding the lectern near a sculpture of a golden fist crushing a U.S. warplane.
Gadhafi was born in 1942 in the central Libyan desert near Sirte, 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 the monarchy of King Idris. A handsome, dashing figure in uniform and sunglasses, Gadhafi 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 proceeded to transform the nation.
A U.S. air base was closed. Some 20,000 Italians were expelled in retaliation for the 1911-41 occupation. Businesses were nationalized.
In 1975 he published the "Green Book," his political manifesto that laid out what he called the "Third International Theory" of government and society. He declared Libya to be a "Jamahiriya" - an Arabic neologism he created meaning roughly "republic of the masses."
Everyone rules, it declared, calling representative democracy a form of tyranny, and Libyans were organized into "people's committees" that went all the way up to a "People's Congress," a sort of parliament.
In the end, rule by all meant rule by none except Gadhafi, who elevated himself to colonel and declared himself "Brother Leader."
"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."
In the 1970s and 1980s, Gadhafi supported groups deemed by the West to be terrorists - from the Irish Republican Army through various radical Palestinian units to militant groups in the Philippines. He 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.
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 Gadhafi opponents outside, killing a British policewoman.
The heat was 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 died.
The Lockerbie bombing followed in 1988, followed a year later by a bombing that downed a French airliner over the West African nation of Niger. The West was outraged, and years of sanctions followed.
Libya's road back from pariah status began in 1999, when Gadhafi's government handed over two Libyans for trial in the Lockerbie bombing. In 2001, a Scottish court convicted one, an intelligence agent, and sentenced him to life imprisonment. The other was acquitted.
In 2002, Gadhafi looked back on his actions and told a crowd of Libyans in the southern city of Sabha: "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."
Throughout his rule, he was a showman who would stop at nothing to make his point.
His appearances at Arab League summits were an annual cause of cringing among fellow Arab rulers. At one, he argued vehemently with Saudi Arabia's King Abdullah, winning the monarch's eternal hatred. At another, Gadhafi smoked cigars on the conference hall floor during speeches to show his contempt.
In a 2009 address at the United Nations, he rambled on about jet lag, then tore up a copy of the U.N. charter, saying the Security Council "should be called the terrorism council."
On state trips, he would insist on setting up a tent to stay in. He sported a personal escort of female guards - which he once explained by saying: "There are no men in the Arab world."
A 2009 U.S. diplomatic cable released by the website WikiLeaks spoke of Gadhafi's intense dislike of staying on upper floors of buildings, aversion to flying over water, and taste for horse racing and flamenco dancing.
"At night, Moammar dreams; by day, he implements," Libyans would say, referring to the bizarre rules Gadhafi would randomly impose on the country, like demanding all storefront doors be painted green, the signature color of his regime. Or like complaining that Libyans were going abroad for medical treatment and deciding it was because of a lack of Libyan doctors - so he ordered Tripoli's main medical school to take 2,000 new students regardless of qualifications, well beyond its 150-student capacity.
He even renamed the months, calling the cold month of January "Ayn al-Nar," Arabic for "Where is the Fire."
In the past decade, power was increasingly concentrated with his eight biological children, who snapped up elite military posts or lucrative business positions. His British-educated son Seif al-Islam was widely seen as being groomed as a successor. There was no immediate word on his fate Thursday.
His 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 did spend oil revenue on building schools, hospitals, irrigation 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.
Still, about a third of Libya's people remain in poverty. Gadhafi showered benefits on parts of the country, such as Tripoli. Meanwhile, eastern Libya, ultimately the source of February's rebellion, was allowed to atrophy.
At least one of his sons, Saif al-Arab, was killed during the 2011 uprising, and another, Khamis, was believed killed. Others, along with his wife Safiya, fled to neighboring Algeria or Niger. Seif al-Islam and Muatassim, who commanded one the military units involved in the crackdown on protesters, fled into hiding when Tripoli fell.
Keath reported from Cairo. Christopher Gillette in Sirte and Rami al-Shaheibi in Tripoli contributed to this report.
© 2011 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.