BAIDA, Libya  As rebellion crept closer to the capital and defections of military officers multiplied, Col. Muammar el-Qaddafi called on thousands of mercenaries and irregular security forces on Wednesday to defend his bastion in Tripoli, in what residents said was a desperate and dangerous turn in the week-old uprising.

Distrustful of even his own generals, Colonel Qaddafi has for years quietly built up this ruthless and loyal force. It is made up of special brigades headed by his sons, segments of the military loyal to his native tribe and its allies, and legions of African mercenaries he has helped train and equip. Many are believed to have fought elsewhere, in places like Sudan, but he has now called them back.

Witnesses said thousands of members of this irregular army were massing on roads to the capital, Tripoli, where one resident described scenes evocative of anarchic Somalia: clusters of heavily armed men in mismatched uniforms clutching machine guns and willing to carry out orders to kill Libyans that other police and military units, and even fighter pilots, have refused.

Some residents of Tripoli said they took the gathering army as a sign that the uprising might be entering a decisive stage, with Colonel Qaddafi fortifying his main stronghold in the capital and protesters there gearing up for their first organized demonstration after days of spontaneous rioting and bloody crackdowns.