In recent months, sirens have wailed in this Yugoslav capital as "enemy" planes swooped in on vital targets. Near the Bulgarian border, "agents provacateurs" infiltrated factories, urging workers to protest against food shortages or low pay.

These war games, often code-named "Nothing Will Surprise Us," are routine here -- illustrating how highly organized are Yugoslavia's defenses.

That defense system presents massive risks for any Afghanistan-style invasion, should the Soviet Union be tempted to intervene after the death of President Josip Broz Tito.

Like Afghanistan, Yugoslavia is a strategically placed nonaligned nation bordering on the Soviet bloc. Both countries are covered by high mountain ranges well suited to guerrilla warfare -- and both boast deep-rooted warrior traditions of resisting enemy occupation.

The essential military difference is that the Yugoslavs are far more heavily armed. Also unlike the Afghans, the Yugoslavs have been preparing in earnest for a Soviet invasion ever since 1948 -- when they became the first communist country to break away from Moscow. It is the thoroughness of these preparations, they believe, that now forms the ultimate guarantee of Yugoslavia's future independence.

Yugoslav defense strategy has drawn its inspiration from the partisan uprising led by Tito against German and Italian occupation in World War II. But it has been refined and updated to meet modern conditions.

In the event of another invasion, it would be the task of Yugoslavia's 260,000-man Army to withstand the frontal attack for as long as possible. Much of the remaining 22 million population would retreat to the mountains for a partisan-type defense. Capitulation to the enemy has been declared unconstitutional.

The regular Army is supplemented by half a million reservists and by territorial defense units numbering several million. Nearly all Yugoslav adult males have had some military training. Compulsory military service lasts about 15 months. Stores of weapons, ammunition and food are hidden in the mountains, ready for a protracted struggle.

In addition to the reservists, who must be prepared to answer a call up in three hours, regular exercises are held for territorial defense units without prior notice. In the Croatian capital of Zagreb, for instance, a newspaper office was hurriedly evacuated to the countryside following a mock poison gas attack.

The philosophy of territorial defense was stated clearly by Tito in a speech last year: "We are trying to ensure the kind of defense which will make anyone wanting to attack us give up his plans in advance. [During the war] we had no arms of our own and instead had to arm ourselves with the weapons of the occupiers.Dealing with a possible new aggressor now will be much easier."

The strategy sounds simple, but there are several possible snags. Despite the Afghan and Czechoslovak precedents, the Soviets would be unlikely to pursue its objectives here through open invasion.

Furthermore, Yugoslavia itself has under gone a massive sociological transformation since the 1940s when peasants living in the mountains formed the backbone of Tito's partisans.

In 1941, when Hitler attacked Yugoslavia, nearly 70 percent of the population lived in rural areas. Like generations of South Slav peasants before them, their first instinct was to defend their families and homes, to fight for their own survival. Tito's genius lay in transforming them into a disciplined army led by communists.

Today, Yugoslavia has become a predominantly urban-based consumer society. Personal advancement rather than personal survival is a basic tenet. sThe rural population has dwindled to around 30 percent.

While eight out of 10 young Yugoslavs declared in a recent opinion poll that they would be prepared to die for their country in the event of an invasion, the shift in population and values poses questions about the effectiveness of partisan-type defense.

The way it works was illustrated by an incident in the Adriatic resort of Dubrovnik several years ago. A British member of Parliament was detained by police following a taxi ride to the airport during which he had used a portable tape recorder to dictate his impressions of Yugoslavia. The driver accused him to trying "to contact foreign aircraft" and promptly handed him over to the police.

During self-protection exercises in southern Serbia last year, workers informed on their colleagues who spread "rumors about imminent price rises." Hotel receptionists immediately reported the arrival and movement of unknown guests. "Hostile propaganda" sent through the mail was intercepted by post office sorting clerks.

One facet of President Tito's skill as a politician was the way he played internal and external threats against each other, uniting the country behind himself in the process. The external threat has been used to justify a strong Army and heigthened vigilance against "foreign infiltration." This in turn has been a valuable weapon against domestic critics.