IT WAS vintage Muammar Qaddafi. After a blood-soaked week of unrest, Libya's leader delivered a rambling, hectoring, fist-pounding speech on February 22nd. He blasted the popular uprising that has left hundreds dead and torn much of the vast north African nation from his grasp as the work of drug addicts and agents of al-Qaeda and America. He shouted that he would never surrender and ordered his men to hunt these “greasy rats” from house to house, without mercy, and take what they wanted. Then he drove off in an electric golf buggy.

After 41 years of his violently capricious rule, Libya's 6.5m people know Mr Qaddafi well enough to take him seriously. No one expects him to go quietly, as the presidents of neighbouring Egypt and Tunisia did. In the densely populated region around the Libyan capital, Tripoli, marauding gangs loyal to the regime, backed by African mercenaries and well-armed troops commanded by Mr Qaddafi's son, Khamis, have spread enough terror to stall the momentum of the street protests that began on February 15th. For now Mr Qaddafi appears safe at his headquarters, within the triple walls of the sprawling Bab al-Aziziya barracks near the city centre.

State television remains in denial, broadcasting rallies in support of the leader, and armed men are intimidating doctors and taking bodies from the streets in an effort to cover up the scale of the deaths. Yet if Mr Qaddafi thinks he can make a comeback, he is surely mistaken. One by one, the pillars of his regime have crumbled. After days of clashes between unarmed protesters and government forces, the whole of Cyrenaica, the country's fertile eastern coastal region, has fallen under rebel control (see article). Many army units have mutinied. Two Libyan air force pilots have defected to Malta, taking their aircraft with them and claiming that they had refused orders to bombard Benghazi, Cyrenaica's main city.

Oil production has slumped (see article) and the economy has ceased to function, not least because thousands of the foreign workers who keep it running have fled, been evacuated, or are trying desperately to leave. Britain's government has been accused of doing too little to get its citizens out, while fear of reprisals against American oil workers persuaded President Barack Obama to say nothing about Libya until February 23rd, when he condemned the violence, but took no action.

The ministers of interior and justice, numerous Libyan diplomats and a senior aide to Saif al-Islam, the most prominent of Mr Qaddafi's seven sons, have all resigned and declared allegiance to the protest movement. The uprising may even have penetrated Mr Qaddafi's inner circle at Bab al-Aziziya, where it is said only one brigade remains loyal to him. Leaders of some of Libya's biggest tribal groups, important constituencies in a country that has only recently urbanised, have openly turned against him. In the region and worldwide, Libya's “Brother Leader” has few friends any more. Governments of all stripes have condemned his tactics against civilian protesters, reportedly including the deployment of helicopter gunships, snipers and heavy-calibre machineguns.

Explore our interactive map and guide to the Arab League countries

Events in Libya unfolded as they have elsewhere. They began with peaceful street protests, word of which spread on the internet, and accelerated dramatically when security forces responded with deadly force. Libya's government also severed communications, blaming foreign meddlers, warning of chaos, and suggesting that reforms are in the offing.

Even the televised speeches by Saif al-Islam and Mr Qaddafi himself, while more chilling in tone, echoed performances by Zine el-Abidine Ben Ali of Tunisia and Hosni Mubarak of Egypt. Both addressed their people with a mix of conciliation and defiance. Both, like Mr Qaddafi, referred to themselves in the third person and belittled the scale and intensity of the opposition. And both then abruptly left office.

Yet Libya is a very different place from its neighbours along the Mediterranean. Its territory and wealth are greater, its population sparser, its sense of nationhood more fragile. Libya's history has been far more traumatic, too. As many as a quarter of its people died, many of disease and starvation in concentration camps, during three decades of Italian invasion and colonial rule that ended with the second world war. The first 20 years of Mr Qaddafi's rule, after a coup he led as a young soldier in 1969, brought wrenching social change. He tried to impose his Third Universal Theory, a sort of Bedouin socialism that exalted the destruction of state bureaucracy, confiscated wealth and empowered “peoples' committees” as the sole form of government.

Mr Qaddafi broke resistance to his policies with a campaign of random terror against “stray dogs”, as he labelled dissidents. Dozens, both in Libya and abroad, were murdered by his agents. Thousands fled into exile. Much of the country's income from oil, which soared in the 1970s, was wasted on arms purchases and sponsorship of revolutionary movements around the world. Some 4,000 Libyan soldiers are believed to have died, for no gain, during Mr Qaddafi's repeated interventions in neighbouring Chad.

In the late 1980s Libya fell under international sanctions after Mr Qaddafi was charged with sponsoring the mid-air bombing of two passenger aircraft, French and American, with the loss of more than 400 lives. In the 1990s hundreds more Libyans died during a brutal campaign against Islamist radicals. Most of the killings were in Cyrenaica, where resentment against Mr Qaddafi also stemmed from economic neglect, the attachment that some retain to the royal family he overthrew, and the fact that Cyrenaica has historically been independent of western Libya.

Mellowing, but not changing

In recent years Mr Qaddafi has appeared to mellow. As it became clear that state-owned enterprises were failing to supply markets, his regime abandoned radical socialism, inviting foreign investment and encouraging private business. International sanctions were lifted after Mr Qaddafi accepted responsibility for the airliner bombings, paid compensation and surrendered two of his agents for trial. He agreed to halt research into nuclear and chemical weapons. He began to cultivate an image as the wise man of Africa, playing host to other leaders. He invited some exiles to return, and allowed his son Saif to present himself as the kinder face of the regime.

Yet the underlying nature of his rule did not change. Behind the confusing veil of peoples' committees, the reality was that Libyans were denied any meaningful role in politics. For a country with the largest oil reserves in Africa, they were surprisingly poor. The government supplied shoddy housing, free cars, schooling and health care, but state salaries seldom exceeded $500 a month and the economy sucked in some 1.5m foreign labourers. Young Libyans struggled to find useful employment. Meanwhile, as in Egypt and Tunisia, Mr Qaddafi's relatives and cronies monopolised many of the most lucrative business opportunities. And Libya's security services still inspired fear.

Nor, as has now become abundantly clear, had Mr Qaddafi really changed his stripes. As far back as 1975 he told an audience of students that he rose to power by force as the leader of a revolution and could only be removed by force. In one of the concluding passages of his Green Book, a stream-of-consciousness promoted as a blueprint for his leadership, Mr Qaddafi, with a characteristic mix of bluntness and illogic, declared that his ideology was “theoretically” a genuine democracy, but in reality, “the strong always rule.” “I was the one who created Libya,” he is said to have declared recently, “and I will be the one to destroy it.” In the typical fashion of dictators, Libya's leader appears to be confusing his own person with the nation as a whole.

There is little doubt that Libya, even without Mr Qaddafi, will remain a messy and possibly violent place. His rule has burdened it with a legacy of inadequate institutions, tangled laws and burning animosities. Sorting through this wreckage will take time, energy and ingenuity. Yet Libya does have some things going for it. It has plenty of cash, with foreign reserves alone totalling nearly $140 billion. Its talented exiles are eager to return. And, in a sense Mr Qaddafi is unlikely to have foreseen, the trauma of his rule may have forged a national identity much more heartfelt than it was before.