BELGRADE, Yugoslavia (AP) _ Televised scenes of surrendering People's Army soldiers and tanks set on fire by the territorial defense force of Slovenia have destroyed the aura of infallibility the army has enjoyed since 1945.

Recruits told harrowing stories on television about being exposed to barrages of fire while forbidden to shoot back.

''My friends and I were sent into action with only three months of basic training,'' said Sasha Kostic, a private from the southern town of Vranje.

The military has repeatedly stressed it had not expected any trouble when it sent only 2,000 men to secure 27 outposts across secessionist Slovenia's borders with Italy, Austria and Hungary from Slovene territorial troops.

But massive protests organized by the parents of soldiers involved in the combat have painfully driven home the army's failures.

The army's erratic response to events in Slovenia indicates possible deep splits among its secretive top echelons.

The General Command responded immediately by sacking the general leading the operation and his air force commander, both Slovenes, and replacing them with more ''motivated'' generals from the country's largest republic, Serbia.

In an unprecedented appearance on national TV, the chief of staff, Lt. Gen. Blagoje Adzic, on Tuesday harshly criticized the federal government for restraining the army's operations with contradictory orders.

He declared that a cease-fire was no longer possible and that the war in Slovenia would be vigorously prosecuted.

Adzic implied there had been widespread treason by Slovene officers who deserted their posts or surrendered entire units, fueling speculation of an imminent purge of Slovene commanders.

Although Serbs make up 60 percent of the officer corps, almost a quarter of the generals and admirals are Slovenes.

Adzic's announcement raised fears that the generals had overthrown the federal government and were clearing the decks for an onslaught on Slovenia.

The confusion was made even greater when Adzic said that federal Defense Minister Veljko Kadijevic would soon speak on television.

Kadijevic, a general, never appeared.

Huge forces, consisting of hundreds of tanks, artillery armored personnel carriers and hastily mobilized reservists, were sent north Tuesday night to relieve the beleaguered outposts in Slovenia.

Inexplicably, however, they halted at the Croatian border, hundreds of miles south of the Slovenian border.

The fierce duels between army tanks and warplanes and Slovene forces also died down overnight, and some units began withdrawing late Wednesday.

No explanation for the unexpected cease-fire was available, but the deputy commander of army forces in Slovenia suddenly announced that his troops would not fire unless attacked.

''The Yugoslav military has always been by far the most secretive in eastern Europe,'' said a Western military attache in Belgrade. ''It's useless trying to penetrate its inner sanctums,''

He said the military seemed to be split between hard-liners, including Adzic and a host of retired but still influential generals, and moderates such as Kadijevic who support efforts to settle the crisis peacefully.

The hard-liners, still smarting at what they say were unprovoked attacks on federal soldiers based in isolated garrisons throughout Slovenia, are believed to want to punish Slovenia's defense force.

''We are aware there is a group of generals who want war - but there are also some people who want to avoid a conflict,'' said Croatia's defense minister, Sime Djodan.