Tripoli, Libya (CNN) -- Over four decades in power in Libya, Moammar Gadhafi portrayed himself as a revolutionary battling Western colonialism, the leader of a united Africa and the "king of kings" of his oil-rich desert nation and beyond.
He died a fugitive in his hometown, hunted down Thursday by the forces that toppled his iron-fisted rule two months ago. His death was cheered by throngs of his countrymen in Tripoli, who let loose with celebratory gunfire and the honking of horns at the news.
Gadhafi's death puts an end to the career of the strongman who came to power in a bloodless coup against King Idris in 1969. The 27-year-old army captain soon adopted the rank of colonel, by which he was known for most of his career. He had a gathering of tribal leaders declare him "king of kings" of Africa in 2008, but the title never quite caught on.
He cut a flamboyant figure in comic-opera military uniforms or tribal robes that played up his Bedouin roots. He sported trademark sunglasses, surrounded himself with an eye-catching female security detail. On a 2009 visit to Italy, he invited 200 models to his ambassador's house, paying each $75 to listen to lectures on Islam and giving each a copy of the Quran.
Saad Djebbar, a former legal adviser to the Libyan government, said Gadhafi's mercurial public image was a calculated ploy, aimed at appearing foolish or mad. But as the "Arab Spring" revolts erupted in neighboring Tunisia and Egypt, toppling long-serving authoritarian leaders, Gadhafi "was completely out of touch of the realities of the new world around him," Djebbar said.
Upon assuming power, he fashioned himself as an Arab nationalist. The United States tried to work with him at first but quickly found out that his brand of nationalism included opposition to the West.
By 1972, he was urging Muslims to fight Western powers. He backed American black militant groups and supplied arms to Palestinian factions battling Israel, as well as to Irish Republican Army fighters battling British rule over Northern Ireland.
His "Green Book," first published in 1975, envisioned a radically simple system of "People's Conferences" that would replace political structures from tribes to parliaments. But Oliver Miles, a former British ambassador to Libya, said the effect of Gadhafi's rule was to leave himself as the nation's sole authority.
"He has destroyed every institution in the country," Miles told CNN. "There is no real civil society in Libya."
Gadhafi said he wanted to unite the Arab world, and even proclaimed a merger of Egypt, Libya and Syria in 1972. That merger plan fell apart, as did a later attempt at a union with Tunisia. Arab leaders largely shunned him, seeing him more as a "buffoon" and a "clown" than a potential regional leader, said Dirk J. Vandewalle, a Libya expert at Dartmouth University.
That rejection from Arab and African leaders, combined with his growing anti-Western sentiment, left him to turn to terrorism in the 1970s and 1980s, Vandewalle said.
In 1986, Libya was implicated in the fatal bombing at a West Berlin nightclub that left one American service member dead, prompting U.S. President Ronald Reagan to dub the Libyan leader the "mad dog of the Middle East." Reagan ordered the United States to bomb Libya and imposed economic sanctions against the North African country.
Two years later, Libya was implicated in the 1988 bombing of Pan Am Flight 103, which killed 270 people when it exploded over Lockerbie, Scotland.
Years later, Gadhafi appeared to moderate and seek rapprochement with the West. In 1999, he turned over suspects in the Lockerbie bombing, and in 2003 the country agreed to eliminate weapons of mass destruction. Those moves paved the way for the lifting of economic sanctions, the restoration of diplomatic relations with Washington in 2006 and Libya's removal from the U.S. list of state sponsors of terrorism the following year.
In the years before the current rebellion started, Gadhafi even hired a public relations firm to burnish his global image as a statesman and a reformer. Starting in 2006, the leader spent about $3 million a year to execute a public relations strategy that included paying think-tank analysts and former government officials to take a free trip to Libya for lectures, discussions and personal meetings with Gadhafi.
Then-U.S. Secretary of State Condoleezza Rice met with Gadhafi in 2008 and "thought he was serious" about Libya's turnabout.
"He said at one point it has taken too long, that the lessons of history had to be learned," Rice later said.
In 2009, Gadhafi became chairman of the African Union, aiming to turn the now-54-member organization into a group of "African united states." He had been working to build his influence in the region for decades, building a gleaming mosque in Niger's capital, Niamey, in the 1970s and another popular mosque in Bamako, the capital of neighboring Mali. Gadhafi also poured money into Chad and Burkina Faso as well.
He addressed the U.N. General Assembly for the first and only time in 2009. In his 96-minute ramble, he denounced the U.N. Security Council as a "terror council," suggested the H1N1 swine-flu virus was a military tool and called for renewed investigations into the assassinations of John F. Kennedy and the Rev. Martin Luther King Jr.
But critics called his plans for a united Africa impractical, and he lost his bid for a second term as AU chairman in 2010.
The bell began to toll for Gadhafi in February after people around the Middle East and North Africa started challenging their leaders in the so-called Arab Spring movement. Gadhafi found himself a target following the ouster of Egyptian President Hosni Mubarak, whom the Libyan leader had supported, as anti-government demonstrations began.
The eastern city of Benghazi fell to rebel forces swiftly as Gadhafi blamed outsiders and "armed gangs" for the violence. He told his people the United States was giving young Libyans "hallucination pills" to fuel the revolt. He vowed never to leave Libya and to "die as a martyr at the end." But his reputation and his fate were largely sealed by his crackdown on protesters and attacks against rebels and civilians alike.
The rebels were soon backed by NATO airstrikes, launched in March under a Security Council resolution authorizing the use of force to protect civilians from reprisals. Over the summer, revolutionary fighters edged closer to Tripoli, cutting off key supply routes for Gadhafi's remaining forces. By August 21, they had broken through into the capital; two days later, they ransacked Gadhafi's Bab al-Aziziya compound.
Members of his family, including his wife and three grown children, soon decamped to Algeria. The "king of kings" remained behind, broadcasting occasional defiant messages by radio and television to his shrinking band of followers.
"All along, he was telling them that he is in a safe place and that he is going to bring them back to power," former aide Abubaker Saad told CNN. "For the past few months, that's basically the message that he was sending. But, of course, in reality, he was hiding and running for his life."
CNN's Mike Pearson, Faith Karimi, Matt Smith, Greg Botelho and Catherine Shoichet contributed to this report.