A heavily armed force of 100 South African commandos flew into the capital city of this mountain kingdom early today and killed at least 37 people in what South Africa said was a strike against guerrillas attempting to overthrow the Pretoria government.

Stunned residents of Lesotho said, however, that most of the victims were political refugees and not active insurgents. Lesotho Foreign Minister Charles Malapo, accusing South Africa of the "murder" of "women, children and refugees," complained to the United Nations about the "grave violation" of "a sovereign member state."

Other governments, including that of the United States, sharply denounced the attack by South Africa, one of several that country has made outside its borders in recent years in a campaign to strike at the African National Congress (ANC), a black nationalist organization outlawed in South Africa in 1961 for its opposition to the government's racial segregation.

"The United States government deplores the South African attack into a neighboring country and especially the loss of innocent life that occurred," the White House and State Department said in similar statements in Washington. "This is the sort of violence which underlies the urgency of finding a means of resolving the problems of the region through peaceful negotiation and conciliation," they said.

The commando force, which hit 12 separate sites in and around this capital, used what residents said were bazookas, machine guns, grenades and incendiary devices to blast doors of homes, demolish their interiors and kill those living there.

Some houses were reduced to charred rubble, with bullet-riddled vehicles standing outside them. Neighbors were dazed with shock but, except in one instance where a woman in a nearby house was shot in the chest and killed when she went to her bedroom window to see what was happening, all the casualties were in the target houses.

Radio Lesotho said tonight that at least 41 black South African exiles were killed in the raid, including several women and children.

Gen. Constand Viljoen, chief of the South African Defense Force, said in a statement issued in Pretoria that 30 "terrorists" were killed and five women and two children "died in the crossfire." He said four South African commandos were wounded, although residents of Lesotho, which has no army and only a 2,000-man paramilitary force, reported virtually no opposition to the surprise attack.

The South African statement charged that the buildings hit "served as planning and control headquarters for ANC terrorist action against South Africa and the republics of Transkei and Ciskei," two countries created by South Africa as homelands for its black residents.

The statement said South Africa had recently learned that the ANC was planning terrorist acts during the coming holiday season and that "a number of well-trained terrorists moved from other southern African states to Lesotho during the past month to execute these plans."

The ANC, in Lusaka, Zambia, called South Africa's charges "utterly false" and said "this cold-blooded massacre" would not stop its fight against white-minority rule in South Africa, Reuter reported.

Lesotho later asked for an urgent meeting of the U.N. Security Council, and diplomatic sources in New York said the council would probably take up the matter Monday.

U.N. Secretary General Javier Perez de Cuellar denounced the raid, saying he was appalled at the loss of innocent lives, The Associated Press reported. Britain condemned the attack and Shridath Ramphal, secretary general of the 41-nation Commonwealth, said the "report of the murderous attack by South African forces on the defenseless capital of Lesotho will be received with deep anger and abhorrence throughout the Commonwealth."

The South African force landed here about 1 a.m. and left about five hours later. Maseru is only a few hundred yards from the border of South Africa, which completely surrounds Lesotho, a country of 1.2 million people that was a British colony until 1966.

One former ANC member who has lived here many years -- and who was fearful of having his name used -- said he knew most of those killed and none had arrived recently. Most had come to Lesotho after the uprising in Soweto, a black township near Johannesburg, in 1976, he said, and he knew of none who had been here less than a year.

Lesotho authorities said the victims were refugees, registered with the Interior Ministry and the U.N. High Commissioner for Refugees.

Vincent Makhele, minister of rural development and secretary general of Lesotho's ruling party, interviewed while inspecting one of the worst-hit residential areas, said the accusation that ANC reinforcements had recently been brought into Lesotho was "simply not true."

"These people were genuine refugees," he said. "We allow them in on condition they do not launch any attacks from our territory and to our knowledge they have kept to these conditions."

South Africa said its "strike force had strict instructions to avoid women and children and Lesotho citizens not involved with the ANC, and the defense force regrets that the innocent also had to suffer." Viljoen claimed that these people had been housed together with "terrorists to discourage action against" the ANC activists.

South Africa has been increasing its warnings to neighboring black states that they risked attack if they harbored ANC insurgents.

The former ANC member said the attackers appeared to have been led to the target houses by informers whose knowledge was dated. In some cases the tenants had changed, and Lesotho citizens were shot instead, he said.

One such was Sally Ralebitso, 21, daughter of a former Lesotho Cabinet minister and ambassador to Mozambique, who had just graduated as the King Moshoeshoe honors student from Lesotho University.

She lived in 28 Koena Flats, an apartment block in the downtown area. The previous tenant was Chris Hani, a top member of the ANC community here. He left Lesotho several months ago, due to South African pressure on the government, according to friends, and Ralebitso moved into number 28.

The South Africans attacked the apartment, splintering the door with machine-gun fire and spraying the interior with bullets, according to witnesses. Ralebitso tried to escape through the window and people in an apartment block opposite said they saw her hang momentarily from the second floor sill before dropping to the ground. She was shot dead there, they said.

Upstairs at number 32, a man known only as Gini to his neighbors, who said they thought he was an ANC refugee, also jumped from his window. The neighbors said he appeared to injure a leg as he hit the ground, and they saw him shot dead as he lay there.

The only resistance appears to have been at a house a block away from the U.S. Embassy and across the road from the home of Edna Booradi, an embassy staff member.

Mathabatha Sexwale and his wife Buni, who lived there, appeared to have fought back and escaped although the house was devastated. Reporters could not trace them today. The Sexwales are well known locally as ANC people who have been in Maseru for several years.

American Ambassador Keith L. Brown, who also lives nearby, said the noise was frightful.

"I got on the radio and spoke to Miss Booradi and told her to keep out of sight," Brown said. "All the embassy staff kept in touch with one another by radio throughout the attack."

Next door to the Sexwales' house, Cecilia Sehlakaba, 28, awakened by the noise, went to her bedroom window to see what was happening. A bullet pierced her chest, killing her.

In another major target area, the adjacent precincts of Thamaes and Qoalen, on the outskirts of Maseru, another house previously occupied by ANC members was hit. A young girl died there.

The hardest-hit target was a squat cinder-block house where eight people were killed.

Two of the three rooms were burnt out, spattered with a black foamy substance, possibly from an incendiary device.

In the third room were pictures and slogans extolling the ANC and radical black leaders elsewhere in Africa. There were numerous pictures of the imprisoned ANC leader, Nelson Mandela.