Sixteen black activist leaders charged with high treason were released from prison tonight after Supreme Court judges overruled an order by the authorities that they could not be granted bail.

The 16, all members of the country's major black political alliance, the United Democratic Front, were freed on varying amounts of bail.

Four judges, in two separate hearings, condemned the law permitting the issue of no-bail orders in what appeared to be the first signs of a reaction by the South African judiciary against wide powers given to the executive to bypass the courts in security cases. Some of the men released tonight in the Natal provincial capital of Pietermaritzburg had been held since August, when the authorities seized organizers of a boycott of elections among the mixed-race and Asian communities that was held under a new national constitution.

Five were part of a group who evaded detention by taking refuge in the British Consulate in Durban in September but who were arrested when they eventually left the mission. Eight others were arrested Feb. 19.

The authorities, invoking a catchall security law, issued an order prohibiting the courts from granting bail to the prisoners before or during their trial, which is to start May 20. Human rights organizations condemned the action as an attempt to immobilize the democratic front by keeping its leading members including two copresidents -- Archie Gumede, 71, and Albertina Sisulu, 66 -- locked up for the better part of two years.

They said the authorities were issuing the no-bail orders to avoid using a system of detention without charges, which the United States has been urging Pretoria to abandon.

Lawyers for the 16 prisoners challenged the no-bail orders in the Natal provincial Supreme Court and won their first round last week when a full bench of three judges, headed by J. Friedman, ruled that the orders were invalid.

He condemned the 1982 law empowering a provincial attorney general to order a court not to grant a prisoner bail if he considers it necessary in the interests of state security, and said it was "a complete anathema" to him that an attorney general should, in effect, be made "a judge in his own cause."

He ordered the attorney general to argue his case for no bail before a judge. This case came before the senior judge of Natal Province, James Milne, today.

Jules Browde, chairman of Lawyers for Human Rights, said of the two judgments: "This is tremendously important. It is the first sign of a reaction on the part of the judiciary against the inroads which the executive has been making for years into the authority of the courts."