South African police shot and killed three black nationalists today who seized 25 hostages inside a bank in Pretoria in an effort to win the release of black political prisoners.

One of the hostages was also killed in the gunbattle that erupted when police stormed the bank in this white-ruled country's capital city. More than 20 were wounded in the incident, South Africa's most dramatic outbreak of organized antigovernment urban violence in recent years.

The three African guerrillas threatened to kill all of the white hostages if their demands were not met, the police said. The six-hour siege in a Pretoria suburb marked the first time whites had been held hostage by black insurgents, local officials said.

A white woman hostage and the three unidentified gunmen, who carried Soviet-made rifles and hand grenades, were killed in an exchange of gunfire when a special counter-insurgency police team entered the three-story bank building, the police said.

Twenty-two wounded, including three policemen, were taken to a nearby hospital. The woman victim died of shrapnel wounds, a hospital spokesman said.

Police commissioner Gen. Michael Geldenhuys refused to disclose the specific demands of the black gunmen. But another source said they were demanding the release and transport by air to Angola of a number of political prisoners, including Nelson Mandela, serving a life sentence for sabotage, Mandela is the former president of the oldest black nationalist movement in South Africa, the African National Congress. He has been in the Robben Island political prison since 1961.

The attack comes at a time when the government has tentatively promised some economic and social reforms. It is not yet certain what effect such attacks may have on the promised reforms.

But the police and other government officials have been warning the public to expect an increase in politically motivated urban violence. Nevertheless, because the bomb siege occurred in a white area, it is certain to heighten tension in the white community.

Since 1961 the African National Congress, which receives support from the Soviet Union, has opted for guerrilla war against the white minority government of South Africa.

After the government banned 19 black political organizations in October 1977, the congress has been enrolling an increasing number of black youths and has been giving them military training.

In recent months the congress has shown increased sophistication in its activities. Two separate assaults last year on police stations that left three black policemen dead were attributed to the congress. Police have apprehended no suspects in those assaults.

The three blacks entered the branch of the Volkskas bank carrying hand bags containing their weapons and hand grenades, Gen. Geldenhuys said. While some customers and bank employees managed to escape, 25 others were held captive.

Two hours later, the men sent out two male hostages with a note containing their demands. The police entered the building an hour later to discuss the demands. But they did not intend to negotiate with the armed men, minister of police Louis le Grange said. "Those demands were never even considered," Le Grange told the South African press agency.

An official statement said the police had installed listening devices and heard everything said inside the building. The statement said, "Shortly before 7 o'clock [the armed men] decided to shoot all the hostages at 7:30. At 7:05, the terrorists began throwing hand grenades and shooting at the hostages with Russian AK47 machine guns. The police task force stormed the building from all angles."

In a television interview, one of the hostages confirmed the police version. But another hostage, P. Bierman, said the two opposing groups started shooting at each other almost at the same moment. He said one of the armed men pulled a hand grenade and dropped it. A hospital spokesman said the injured were treated for shrapnel and gun wounds.