The Rev. Allan Boesak, one of the country's most prominent civil rights leaders, was released on bail from prison today but charged with political subversion for, among other allegations, advocating that western nations withdraw their investments from South Africa.

Boesak, who was arrested Aug. 27, faces up to 25 years imprisonment on each of three counts under the state's sweeping Internal Security Act. Civil rights lawyers here said he was the first person ever charged for allegedly advocating divestiture.

He was released on $8,000 bail, placed under a modified form of house arrest and ordered not to speak to the press.

Meanwhile South African President Pieter W. Botha, restating his hard-line stance in the face of continuing international condemnation and economic pressure, called on South Africans to stand united against "the forces of darkness, which, with foreign help, are trying to destroy our fatherland."

Following Botha's speech before loyalists of his ruling National Party in Pretoria, the government acknowledged publicly for the first time that it has supported Angolan rebels seeking to overthrow the Marxist government in Luanda. Defense Minister Magnus Malan said in a statement that South Africa supplies "material, humanitarian and moral" support to the guerrillas of the National Union for the Total Independence of Angola (UNITA) led by Jonas Savimbi.

Malan's statement said that the links to UNITA were an "open secret" and that it was government policy to support anticommunist movements. "South Africa reserves the right to protect its own security interests," he said.

He did not comment on reports that the South African invasion of southern Angola announced last Monday was designed to help Savimbi's rebels fend off a new offensive by forces of the Luanda government. South Africa has said that the operation was aimed at Namibian rebels operating from Angolan territory and that its troops will be out by the end of this weekend.

Malan said South Africa would withdraw its support of Savimbi when Cuba and the Soviet Union withdraw the estimated 25,000 Cuban troops and military advisers from Angola.

Today's statement appeared to constitute another setback for U.S. diplomatic efforts to negotiate an agreement between Pretoria and Luanda that would lead to the withdrawal of Cuban troop and independence for the South African-controlled territory of Namibia. Angolan officials long have claimed that they cannot afford to have the Cubans depart as long as Savimbi receives outside support.

Boesak is a theologian of mixed race who is president of the World Alliance of Reformed Churches and a founder of the opposition United Democratic Front. He was detained without charge under the security act the day before he had planned to lead a protest march to Pollsmoor Prison near Cape Town to demand the release of imprisoned black nationalist leader Nelson Mandela.

Under the internal security law, Boesak could have been held indefinitely in solitary confinement without charge or access to lawyers or family. Looking tired but cheerful, he appeared briefly before a magistrate in the town of Malmesbury, north of Cape Town, this morning and was charged with three counts of political subversion under Section 54 of the security act.

The magistrate said the charges were related to meetings Boesak attended in western Cape Province this year at which he allegedly "attempted to jeopardize the authority of the state" by advocating school and economic boycotts. At one of the meetings, Boesak also allegedly advocated divestiture.

Boesak also faces one count of civil disobedience under Section 57 of the act, for encouraging the Pollsmoor march in defiance of a government ban on "illegal gatherings." Police using whips, tear gas and rubber bullets broke up the peaceful march, an action that helped set off two weeks of rioting in black and mixed-race townships outside Cape Town.

Opponents of the government's apartheid system of segregation long have said blacks cannot honestly give their views about divestiture because of fear of prosecution. Until today, critics of the divestiture campaign have dismissed that argument by noting that no one had faced such a charge.

"This is a sinister charge because the state has used it before as a threat but has never actually prosecuted anyone under it," said Prof. John Dugard, director of the Center for Applied Legal Studies at the University of Witwatersrand.

The magistrate, Andre Dippenaar, said the charges were "provisional" and could be revised later. Boesak was not asked to plead and is due to appear again Nov. 6.

Under restrictions attached to his release, Boesak was required to turn in his passport, refrain from addressing meetings of more than 10 persons, apart from church services, or from advocating school boycotts or divestiture. He is required to report to police each morning and cannot leave his home at night nor travel outside his magisterial district without written police permission.

While Boesak was appearing near Cape Town, police in Pretoria announced that they had made 350 more arrests using their emergency powers, bringing to 3,577 the total arrested since Botha declared a state of emergency in 36 districts nine weeks ago. Of those arrested, 1,398 still are being held. The figure did not include 746 black high school students arrested under the emergency decree last week and released two days later.

In his Pretoria speech to his party's Transvaal provincial congress, Botha said he hoped to announce new, unspecified changes in government policy later this month. But he said he would not back away from his refusal to consider a one-man, one-vote system of democracy for South Africa nor would he consider establishing a separate parliamentary house for blacks as the government previously has done for the mixed-race Coloreds and for Asians.

He also appeared to set new conditions for talks with the outlawed African National Congress, the exiled rebel movement opposing white rule. Not only would the group have to renounce violence, Botha said, but it also must break all ties with South African Communists and the Soviet Union, its chief arms supplier, and "declare itself willing to participate in the process of reform by constitutional means."

Botha said the ANC was seeking to manipulate international opinion and South African business leaders, some of whom met with ANC leaders a week ago in Zambia.

Finance Minister Barend du Plessis announced a series of new measures tonight to revive South Africa's battered economy, including a 10 percent surcharge on imports. The move, which is likely to stimulate the country's double-digit inflation further, is designed to slow the outflow of dollars that is contributing to the continued weakness of its currency. The rand remained below 40 U.S. cents today in trading on local currency markets.

The minister of education for South Africa's mixed-race schools, said today that 465 public schools in western Cape Province, closed two weeks ago because of political unrest, would be reopened Saturday. The move affects nearly a half million students and follows widespread protests against the closures.