AS THE rebel insurgency flowed and ebbed across Libya this year, it passed through most of the staging posts in Muammar Qaddafi's life. Sirte, where he was born in a Bedouin tent in the sand-wastes and died amid the crackle of sniper fire; Misrata, where he went to a private tutor to learn history; Benghazi, where at military college he began to plot revolution; and Tripoli, where in the sprawling half-bombed barracks at Bab el-Aziziya he pitched his tent again, the Brother-Leader, insisting he would never leave until he had fired the last bullet he possessed.

When death overtook him, he had ruled Libya for 42 years. The handsome, magnetic army captain who had overthrown King Idris in 1969 had become a robed buffoon, with a surgically smoothed face, a mop of dyed black hair and, until she scuttled home, a blonde Ukrainian nurse on his arm. Yet he was no less cunning. Behind the designer shades his eyes were those of a fox. By sheer imposition of the cult of himself, he had held his tribally fractious country together.

He ruled unsparingly. In his Libya, dissent was punishable by death. A private press was forbidden, and political parties banned. Several dozen deaths a year of political opponents were attributed to his secret police, acting on tip-offs from the surveillance committees to which around 10% of Libyans belonged. In Abu Salim prison, on one night in 1996, 1,200 political prisoners died. If his enemies fled abroad, his hired assassins found these “scum” and killed them. The colonel's writ, as recorded in his “Green Book” of rambling political philosophy, replaced the rule of law.

His rule had begun better. Like Venezuela's Hugo Chávez, a rare ally, he came to power determined to secure oil revenues for his people rather than for foreign corporations. Having renegotiated the oil contracts, he redistributed wealth and saw Libya grow rich—though no one grew rich faster than his own clan, with billions invested abroad. Oil gave him power far beyond the confines of his dilapidated state. He began to see himself as the leader of the Third World, the voice of the world's poor, the King of Africa (when, in 2009, he chaired the Organisation of African Unity) and the patron of world revolution. He invited to Libya for military training such bloodstained luminaries as Liberia's Charles Taylor and Sierra Leone's rebel leader, Foday Sankoh. He gave money to Colombia's FARC and the IRA, and tried to radicalise even the Maoris of New Zealand. Wherever anti-Western or anti-parliamentary feelings stirred, he was there, sowing trouble; for as he said in the “Green Book”, the only true democracy was the direct, even violent, expression of the will of the people—except in Libya.

Around this figure the West, for four decades, prevaricated. The young colonel's “Third Mystery of Socialism”, a middle way between capitalism and communism which, in his words, solved all the contradictions of either system, seemed unthreatening enough. His people's communes were blatantly powerless, his own “brotherly” power absolute, but then absolutism was common enough in oil-producing states. He was not a Marxist, at least: Egypt's nationalist hero, Gamal Abdel Nasser, was his model, rather than Lenin. And he had oil.

Use the interactive "carousel" to browse all our coverage of the Arab uprising through graphics

Eventually tolerance snapped. In the 1980s, as Colonel Qaddafi shopped round the Far East for nuclear bombs, sponsored terror groups, invaded Chad in the cause of a “Greater Libya” and sent agents to blow up a Pan Am airliner over Lockerbie in Scotland, he became a pariah: Ronald Reagan's “mad dog”, to be bombed until he whimpered. But by the new century he was ingratiating himself. He said the right things about al-Qaeda; offered his nuclear programme for inspection, and in 2003 abandoned it; paid compensation for Lockerbie; and, apparently chastened by his own military incompetence, seemed to have forgotten his windy pan-Arab and pan-Islamist dreams. In a world suddenly teeming with dangerous Islamists, he was now far from the worst. At the G8 in 2009 he shook hands with Barack Obama. The same year he was allowed to speak for more than an hour at the UN, repaying its tolerance by tearing from the UN Charter the pages that talked about democracy.

Pitching his tent

He never forgot his origins among the desert wanderers and cattlemen. Despite the gilded mermaids and white pianos of his ludicrous quarters in Tripoli, he preferred to live in a tent, and always travelled abroad with one. When not in uniform, he wore flowing robes. His grandest project, the Great Man-Made River, brought water from southern aquifers to the northern cities. Precious green was his colour, in flags, Book and billboards. His socialism, at root, was based in desert customs of shared property and grazing land. His deep devotion to the army was the gratitude of a poor boy who had used it as a ladder to higher social rank and more grandiose ambitions.

Almost to the last, too, he tried to pose as one of his people. When protesters first erupted on the streets of Tripoli this year, he offered to protest along with them. Surely, after years of venomous pabulum from his “Green Book”, they would have learned to think as he did. But they were beginning to dare to think differently—about Libya, and about him.