From the moment 17 years ago that Muammar Gaddafi seized power in Libya by a bloodless coup, he seemed to fancy himself a latter-day caliph from the Arabian Nights. Donning disguises, he ventured out on the streets of Tripoli at night to mingle with the common people, sometimes bursting into nightclubs, pistol in hand, and ordering the floor-show dancers arrested for immodesty. He had a habit of popping up unannounced on the doorsteps of leaders of neighboring Arab states as if he had just arrived by magic carpet; on occasion, he rudely unholstered his gun in the midst of a diplomatic discussion to add emphasis to his opinions. At times, Gaddafi did a vanishing act, disappearing for weeks or months on end to commune with God under the stars in the Sahara desert.

The mercurial dictator is still a master of surprises, whose latest legerdemain includes an uncanny ability to postpone his demise. Catapulted during his reign from obscurity to notoriety as a deep-pocketed patron of international terror, Gaddafi has survived nearly a dozen assassination and coup attempts. He claims to be protected by barakah, a kind of Islamic guardian angel. He is, moreover, remarkably shrewd in sensing plots against him and lives behind a shield of heavy security, including a cadre of female bodyguards, the Green Nuns, who are crack shots. Given his growing paranoia over his personal safety, it is not surprising that Gaddafi emerged unharmed after U.S. Air Force F-111 fighter-bombers dropped 16 tons of explosives on his command and communications center in Tripoli. His escape from the bombs, in fact, may have strengthened his mystical hold over the people of his oil-rich desert nation. "We probably put off a coup that was coming in the next year or so," Lisa Anderson, a specialist in Libyan politics at Columbia University, has said.

President Reagan has characterized Gaddafi as a "flaky barbarian" and "the mad dog of the Middle East." Although Gaddafi seems to artfully cultivate his image as an unpredictable maniac, he is known to experience rapid mood swings from periods of intense activity to depressed withdrawal. A ranking figure in the Palestine Liberation Organization claims that Gaddafi was secretly treated for a mental condition, possibly schizophrenia or paranoia, by an Italian psychiatrist who visited Libya several times. But psychological profiles drawn by both the CIA and Israeli intelligence reportedly discount any possibility of real madness. Most expert Libya watchers agree that Gaddafi is anything but deranged. "He's a very intelligent man who knows exactly what he wants," says Marius Deeb, a professor of Arab studies at Georgetown University in Washington, D.C. "He has an incredible ability to outwit and outmaneuver his enemies."

An Italian diplomat who knows him well is convinced that Gaddafi is sane but that he suffers from a kind of political inferiority complex. "From the outside he looks ridiculous because Libya is such a small country. It's one of Gaddafi's problems to feel himself a towering figure who should be a leader in the Arab world and then to be brought sharply back to reality."

What makes him truly a menace is the rigid belligerence of his world view. Driven by religious zeal, he sees the Mideast in black (Israel) and white (the Arabs) and is fully prepared to become a martyr to what he believes is the revealed truth of Islam. Absolutely paramount, in Gaddafi's thinking, is the continuation of a holy war against Israel and its supporters in the United States and Western Europe. Gaddafi gave safe haven to the Soviet-trained terrorist "Carlos the Jackal," after he reputedly masterminded the Black September massacre of 11 Israeli athletes at the 1972 Munich Olympics. More recently, Gaddafi has backed Abu Nidal, leader of a radical Palestinian group accused of carrying out the attacks on the Rome and Vienna airports last Dec. 27 that killed 19 people and wounded more than 100.

Though he does not smoke or drink, prays to Allah five times a day and makes much of his austere life-style, Gaddafi is a vain man with a weakness for women, particularly women journalists. Criticized for being overly favorable to Gaddafi in a 1976 filmed report, British free-lance television producer Vanya Kewley replied, "I don't make him look attractive. He is very attractive, very sexy, very sensuous." Gaddafi is known also to enjoy preening for the camera, making rapid costume switches from well-tailored safari suits to flowing Arab robes to rakish military uniforms. Sometimes his theatrical posturing borders on the absurd: Conscious of his rather ordinary stature, he has appeared in public tottering precariously on boots with 2½-inch lifts.

The former president of the Sudan, Gaafar Nimeiri, once described Gaddafi as "a split personality—both evil." Without doubt, in both character and conduct he presents baffling contradictions. He boards a gunboat to defend the "line of death" in the Gulf of Sidra, only to return minutes later complaining of seasickness. He calls himself Leader of the Revolution, disavowing any official title in deference to democracy, yet rules with the imperious power of a despot. He proclaims himself a man of peace, yet from 1980 to 1985 ordered the execution of 21 Libyans living in exile in Europe, casually dubbing them "stray dogs." Ignoring the reality that Libya is a small nation (pop. 3.8 million), Gaddafi pursues his grandiose dream of uniting the Arab world. (In the 1973 war with Israel, he proposed to Syria and Egypt that he should be supreme commander of the Arab armies.) Most perplexing of all are the irreconcilable images of Gaddafi the bloodthirsty warmaker haranguing his people in four-hour television speeches and Gaddafi the family man, surrounded by his affectionate children. By most reports, he is devoted to his second wife, Safia, a nurse he met while hospitalized for a minor operation in 1970, and their seven children. (His first wife was a former schoolteacher whom he had never set eyes on before the wedding; Gaddafi has one child by the marriage, which ended after only six months.)

In times of crisis, Gaddafi retreats even from his family and seeks the solitude he knew in his lonely boyhood. Born in 1942 in a goatskin tent in the desert, he spent much of his early childhood tending camels and horses. Then his ambitious father, an illiterate barley farmer and livestock trader, sent him away to a Muslim school in the town of Sirte. He was taunted by his schoolmates as an ignorant Bedouin and had to sleep on the floor of a mosque because he was so poor.

As a teenager, Gaddafi listened entranced to the fiery speeches of Gamal Abdel Nasser, broadcast from Cairo, and became an apostle of the Egyptian strongman's militant philosophy. By the time he was 14, Gaddafi was leading pro-Nasser and anti-Israel student demonstrations. Seven years later he entered the Libyan military academy and began to plot the overthrow of Libya's pro-Western King Idris.

Following a six-month sojourn in England in 1966 for training in armored warfare, Gaddafi rose steadily in the ranks of the Libyan army and within three years had recruited enough coconspirators to move against the monarch. In the early hours of the morning on Sept. 1, 1969, while King Idris was vacationing in Turkey and Greece, Gaddafi's young revolutionaries took control.

Just 27 when he became ruler of Libya, Gaddafi quickly set about converting it into his vision of an Islamic Utopia. Drawing on the country's oil wealth, he ordered the tents and shacks of Tripoli and Benghazi razed and replaced by new housing, schools and hospitals. At the same time, he closed brothels and banned the consumption of alcohol. Eventually he imposed Koranic law, which calls for cutting off thieves' hands and stoning adulterers to death. His moral and political theories, which often read like gibberish, appeared in his three-volume Green Book, published in the late '70s. This work, he told Italian journalist Oriana Fallaci grandly, "is the product of the struggle of humankind. It's the gospel of the new era, the era of the masses."

Gaddafi initially kept his distance from the Soviet Union and, therefore, despite his virulent anti-Israel stance, was viewed with favor by U.S. officials. Until he made his first major arms deal with the Soviets in 1974, he enjoyed the protection of the CIA and Western intelligence services, who helped thwart at least two coup attempts. (Even after the American government cooled toward Gaddafi, two former CIA operatives, Frank Terpil and Edwin Wilson, contracted to sell the Libyan leader sophisticated time-delay bomb detonators as well as 21 tons of C-4, a very powerful military and demolition explosive.)

Gaddafi has sworn to strike back at the U.S. and may make good on his threat to order suicide squad attacks on American targets. His proven ruthlessness offers ample reason for apprehension. The U.S. bombing attack on Libya struck close to his heart, reportedly killing his adopted infant daughter and seriously injuring two of his sons. If the reaction of his wife Safia is any measure, the desire for revenge runs very deep. "From now on until I die," she says, "I consider America my own enemy unless they give Reagan the death sentence."