JOHANNESBURG, DEC. 5 -- The armed forces chief said today that South African troops are withdrawing from Angola after intervening there in support of anti-Marxist rebels during heavy fighting.

The announcement by Gen. Jannie Geldenhuys coincided with a report that Cuban reinforcements had arrived in Angola and might join government forces in an attack on the South Africans if Pretoria did not withdraw its troops.

The Mozambican news agency AIM said in a dispatch from Angola that the new Cuban arrivals included an experienced battle commander and that Cuba's 50th Division was on its way to the war zone in the southeast.

Geldenhuys said the decision to withdraw "followed the successful completion of certain tasks in the interest of South Africa." The rebels claim they beat back a major government offensive in late October and early November.

The general would not elaborate about the withdrawal other than to say it was "to ensure that the safety of our soldiers is not unnecessarily jeopardized."

South Africa has provided military aid to the National Union for the Total Independence of Angola (UNITA) throughout the civil war the rebels have waged since Angola won independence from Portugal in 1975.

On Nov. 11, South Africa announced that its combat forces had intervened on UNITA's behalf to help repel the offensive by Angola's Soviet- and Cuban-backed Army.

Since then, South Africa has reported the deaths of 27 white soldiers. The Army has said black Namibian and Angolan soldiers in its ranks also have died, but has not given total numbers.

The losses jarred many white South Africans, even those who supported the intervention. The Army has repeatedly stressed that it sought to minimize its casualties.

South Africa has not disclosed the size of its force in Angola, which has been estimated at between 2,500 and 5,000 men.

Angola's chief of staff, Lt. Gen. Antonio Dos Santos Franca, was quoted by AIM yesterday as saying an attack on the South Africans was likely unless they withdrew.

"We don't see any other solution," the general was quoted as saying in an interview.

Angola has denied South African claims that the estimated 37,000 Cubans in the country were heavily involved in the recent fighting. But Franca was quoted as saying the Cubans might play a major role in the next round of combat.

"The Cubans are in Angola with military units whose purpose is to block large-scale South African invasions," AIM quoted Franca as saying. "We cannot exclude the possibility of combat between the Cuban troops and the South Africans."

In its dispatch from Angola, AIM said the command of Cuban forces would be taken over by Gen. Arnaldo Ochoa Sanchez, a decorated officer who held command positions in Ethiopia and Nicaragua as well as during a stint in Angola 10 years ago.