In the modern pantheon of the world's dictators, Moammar Kadafi stood apart. Far apart.

Erratic and mercurial, he fancied himself a political philosopher, practiced an unorthodox and deadly diplomacy, and cut a sometimes cartoonish figure in flowing robes and dark sunglasses, surrounded by heavily armed female bodyguards.

He ruled Libya with an iron fist for 42 years, bestowing on himself an array of titles, including "king of culture," "king of kings of Africa" and, simply, "leader of the revolution."

It was as an actor on the world stage, though, that he showed his gift for unpredictability. President Reagan called him "the mad dog of the Middle East." Anwar Sadat, the late Egyptian president, once said Kadafi was "either 100% crazy or possessed of the devil." Others thought he was both.

When Kadafi took power in 1969, he embraced an adventurist foreign policy, championing his dream of a utopian, Islamic nation that would span northern Africa. He eschewed both communism and capitalism and called his political system jamahiriya, or "republic of the masses."

He soon evolved into an international troublemaker: His Libya funded guerrilla groups, built a nuclear weapons program and launched terrorist attacks on the West — including the 1988 bombing of Pan Am Flight 103 over Lockerbie, Scotland. Then, as the United States began hunting terrorists worldwide, he did a diplomatic U-turn, making oil deals with the West and providing back-channel help for American spy agencies battling international terrorists.

It was the "Arab Spring" uprising against tyrants in the Middle East that ignited an internal rebellion against Kadafi, turned his regime into a NATO target and led to the end of his reign. On Thursday, in his hometown of Surt on the Mediterranean Sea, it was over. He was 69.

The only son of an illiterate Bedouin herder, Kadafi was born in 1942 in a goatskin tent about 20 miles from Surt and spent his early years living the life of desert nomads. His father scrimped and borrowed to send his son to a nearby Muslim school. It was there that Kadafi listened daily to a Cairo radio station that carried speeches by Egyptian President Gamal Abdel Nasser, a pan-Arabist and leader of the independence movement in the Arab world.

"We must go into the army," Kadafi told his classmates. "That is the only way to make a revolution."

He was 14 when he led his first demonstration in support of Nasser, and by the time he was 19 he had taken the first step toward formulating a plan to overthrow the corrupt, pro-Western regime of Libya's King Idris by entering the Royal Military Academy at Benghazi.

Kadafi surrounded himself with fellow conspirators and imposed the same moral standards on them that he demanded of himself: abstinence from tobacco and alcohol, no womanizing or gambling, prayers five times a day. In 1966, he studied armored warfare tactics in Britain, where he learned to speak English.

On Sept. 1, 1969, Kadafi, a 27-year-old signal corps captain in the Libyan army, and his group of "free officers" overthrew Idris, who was out of the country, in a bloodless coup. Kadafi himself went to the state radio station to broadcast the news to the Libyan people.

"Give us your hands. Open up your hearts to us," he said. "Forget past misfortunes and as one people prepare to face the enemies of Islam, the enemies of humanity.... We shall resurrect our heritage. We shall avenge our wounded dignity and restore the rights which have been wrested from us."

He moved quickly in an effort to change Libya overnight. He ordered the closure of the United States' huge Wheelus air base — negotiations were carried out amicably between Washington and Tripoli — and the evacuation of British military bases. He expelled 20,000 Italians and nationalized most of the oil industry. Nightclubs and casinos were shuttered, alcohol was banned, and unmarried women who became pregnant were flogged and sent off to reformatories.

Angered by the amount of time his bureaucrats spent reading newspapers and drinking coffee, he had most of the desks and chairs removed from government offices. The bureaucrats were not fazed; they took to reading their newspapers leaning against the walls and brewing their coffee on the concrete floors.

During his first full decade in power, Kadafi was a popular leader. He invested some of the nation's $50 billion in annual oil revenue in developing agriculture and building schools, hospitals and housing.

In the 1970s, Kadafi developed his so-called Third Universal Theory. It was his blueprint for a socialistic welfare state in which there would be no laws, no money, no government, no private enterprise. The leader — Kadafi never called himself president — published this philosophy in a slim volume called "The Green Book."

He managed to attract a group of leftist scholars to Libya in 1979 to debate the wisdom of "The Green Book," though most impartial observers found it most noteworthy for its naivete and lack of depth. One example from its text: "Woman is a female and man, being a male, does not … get pregnant … [and] is not liable to the feebleness which woman, being a female, suffers."

Kadafi detested communism as much as capitalism, distrusted the Soviet Union no less than the United States and had little use for the moderate Arab states. In 1984, displeased with his North African neighbors, he sent one of his planes to bomb the state radio station in Sudan and, it is widely believed, one of his ships to sow mines in Egypt's Gulf of Suez.

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.

Whatever the explanation for his behavior, he was a man who marched to his own inner voice, convinced that he was the only Arab in step with the times.

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.

The final rebellion against Kadafi was years in the making, and it burst forth as part of the wave of uprisings against autocrats and kings that has swept North Africa and the Middle East this year.

Kadafi underestimated the rage against him as protests that began in eastern Libya flared across the country. Rebels pushed toward Tripoli from the east and west and battled his beleaguered army and band of mercenaries.

The leader's vicious assaults on his own people — his forces fired antiaircraft guns at civilians and shot worshipers near mosques — stunned the world. Much of the military and many Libyan diplomats and officials abandoned him as tens of thousands of people died.

As the revolt spread over the ensuing months, Kadafi became increasingly cornered. He was indicted by the International Criminal Court, and North Atlantic Treaty Organization bombardments of government military forces strengthened the bands of poorly equipped and ill-trained rebels.

Yet, the leader remained defiant. Addressing thousands of Libyans in Tripoli's Green Square in July, he threatened to dispatch Libyan suicide bombers to Europe in retaliation for the NATO bombings. "I told you it is an eye for an eye and a tooth for a tooth," Kadafi said.

He disappeared from public view, releasing video speeches until finally, as rebels closed in, transmitting only audio messages from hiding.

"I say to crusader cowards, I live in a place you cannot reach," he said during one broadcast. "I live in the hearts of millions.... If you kill my body, you cannot kill my soul."

All along, he was unmoved by calls for his ouster, arguing that his authority transcended any official title.

"Moammar is not a president to leave his post," he said. "Moammar is leader of the revolution until the end of time."

After 10 people were shot — seven of them in one incident — overnight in Baltimore following the city's most violent month in decades, police announced Sunday that 10 federal agents will embed with the city's homicide unit for the next two months.