THE GLOBAL advance of democracy has left behind pockets of totalitarian and feudal governance, and perhaps few as threadbare and grim as President Mohamed Siad Barre's 21-year-old military regime in Somalia. There on the tip of Africa's eastern Horn this discredited octogenarian seems to be facing a terminal challenge from the at least temporarily united clans and ethnic groups he had successfully divided and then ruled in the past. No one familiar with the repression and poverty Mr. Siad Barre has inflicted upon his hapless people can wish his rule to be extended by a day.

There is as always the question of what will follow. Almost all the states made up from the former European colonies in Africa have had to struggle with the dilemma of combining old tribal patterns and rivalries with new requirements for political and economic modernization. The extended, bloody and wasteful manner of the Siad Barre regime's passing does not encourage hopes that strong democratic institutions can soon be put in its place. War-related deaths in the past few years are put in the tens of thousands and refugees forced across the borders in the hundreds of thousands. Somalia is being anxiously spoken of as "another Liberia" -- a reference to the West African country whose awful internal splits have spilled over into the surrounding region.

It is sobering to recall that not so long ago both the United States and the Soviet Union regarded Somalia as one of those Third World places worth gaining position and influence in. Finding himself suddenly the object of great-power competition, President Siad Barre responded as almost anyone so tempted might -- by joining the great game and attempting to get the most for himself out of it. Turning East, he made a connection with Moscow, which emboldened him to make a most unwise declaration of war against his far more powerful neighbor, Ethiopia, to snatch its mainly ethnic Somali region of Ogaden. In defeat, he turned around and made a connection with Washington. But the relationship was disappointing at both ends -- so much so at the American end, in fact, that although the United States has had the formal right to use Somali ports for its Gulf buildup, it chose not to.

The new leaders of Somalia, whoever they turn out to be, must rebuild from scratch. They deserve help to the extent that they show they have the confidence of their people.