Some critics dismissed Kadafi as mad, and pointed to unsubstantiated reports of frequent mental breakdowns. Others believed he was simply obsessed with his self-proclaimed assumption of the mantle of Nasser's pan-Arab movement, which had lost its credibility elsewhere years earlier.
It was during the late 1970s and '80s that Kadafi's reputation at home began to suffer serious damage. He began to crack down on dissent, banning strikes and stifling the media. He banned private enterprise and Western literature, and his agents assassinated government opponents at home and abroad.
Kadafi's attempts at economic and political reform also withered as his government became increasingly decentralized. Libya was largely run by local "revolutionary" committees that were inept and corrupt.
Despite the troubles at home, where he was known by many names, including Colonel and Brother Leader, Kadafi began to cause mischief further afield, giving money to guerrilla groups and reportedly attempting to stage coups against other African leaders. Libya was swiftly earning a reputation as a dangerous, rogue state.
He was linked to an attack on a Berlin disco frequented by U.S. soldiers that left two servicemen dead and prompted Reagan to bomb Libya in 1986, an attack that killed Kadafi's adopted daughter. Two years later, Tripoli was implicated in the bombing of the Pan Am 747 over Scotland. Abdel Basset Ali Megrahi, an alleged Libyan intelligence officer, was convicted in 2001.
Kadafi agreed to pay nearly $3 billion in compensation to families of the airline bombing victims. Megrahi was released from prison in 2009 for medical reasons, drawing criticism in Britain that a deal with Kadafi had been struck to protect European businesses and trade.
The U.S.-led invasion of Iraq in 2003 startled Kadafi. Worrying that his own regime could be in jeopardy, he denounced weapons of mass destruction and offered to open his nuclear program to international inspectors. The move helped ease economic sanctions against Libya and put Kadafi in the spotlight as leaders such as British Prime Minister Tony Blair visited Tripoli in 2004.
"It was strange, given the history, to come here and do this and of course I am conscious of the pain that people have suffered as a result of terrorist actions in the past," Blair said of his meeting with Kadafi. "But the world is changing and we have got to do everything we possibly can to tackle the security threat that faces us."
President George W. Bush announced the gradual restoring of diplomatic relations between the United States and Libya. Condoleezza Rice visited Libya in 2008, the first secretary of State to make that journey in more than half a century. A U.S. diplomatic cable published by WikiLeaks advised Rice that, although Kadafi avoids making eye contact, he was a voracious consumer of news and eager for the chance to "share with you his views on global affairs."
Still, Kadafi, who had survived attempted coups and assassinations, retained his swagger. He pitched tents during his travels abroad and periodically railed against the imperialist West.
In a vintage 90-minute-plus address to the United Nations in 2009, he called the 15-member Security Council the "terror council" and quipped that anti-terrorism measures in the United States were like "being a prisoner in the Guantanamo camp, where there is no free movement."
Meanwhile, diplomats traded gossip about the reclusive leader's habits. Other U.S. diplomatic cables published by WikiLeaks suggested that he was a hypochondriac who hated flying over water, often fasted on Mondays and Thursdays, had a phobia about staying on the upper floors of buildings and loved flamenco dancing. The memos also reported that a ''voluptuous blonde'' nurse from Ukraine was a constant companion. The leaked cables were attributed to Gene Cretz, the U.S. ambassador, who left Tripoli after receiving threats.
Things weren't going well for Kadafi inside Libya. His political and economic reforms were seen as ruses by a population stifled by repression and limited opportunities.
In recent years, the country had watched schools, hospitals and other institutions built by the oil money fall into disrepair. His son Seif Islam "implicitly criticized" his father's regime, according to one U.S. cable published by WikiLeaks.
Kadafi himself blamed his government for corruption but it was largely seen as posturing.
The eastern part of the country around the city of Benghazi, a long-simmering anti-Kadafi stronghold, grew more restive. Major tribes, the key to power in Libya, grew increasingly wary of him. Kadafi had lost his touch with manipulating clan loyalties with money and power.
Meanwhile, the antics and lavish lifestyle of his family, which diplomatic cables described as providing "enough dirt for a Libyan soap opera," became more of an embarrassment. His son Mutassim, Libya's national security advisor, paid Mariah Carey $1 million to sing four songs at a private party in the Caribbean. There were reports that Mutassim was among those killed along with his father Thursday.
A 2008 U.S. diplomatic cable titled "Thug Life" describes Kadafi's strained ties with Switzerland after his son Hannibal was arrested in Geneva on charges of abusing servants.