A tiny group of Hanafi Muslims, perhaps fewer than 10 people altogether, terrorized the nation's capital yesterday, killing, wounding and threatening a bloody end for dozens of hostages they captured around midday at three busy locations.

By nightfall, the Hanafi gunmen, members of a small black group of Muslims here who were armed with guns and machetes, held anywhere from 20 to 30 to 100 hostages at the B'nai B'rith headquarters on Rhode Island Avenue NW near Scott Circle, the Islamic center on Massachusetts Avenue NW at the edge of Rock Creek Park, and in the D.C. City Council chambers in the District Building downtown.

City Councilman Marion Barry was shot outside the district Building's Council Chambers but survived a wound near his heart. WHUR radio reporter Maurice Williams was killed in the same hallway. At least seven other citizens were wounded, several seriously, as the bewildering drama unfolded in the heart of the city.

Police said last night that an unidentified fifth person was injured and presumed dead in the District Building incident. Police said that the injured or dead person's body was still in the building last night.

At the B'nai B'rith building, the Hanafi group's leader, Hamaas Abdul Khaalis, issued via telephone and television apocalyptic warnings and demands. "Tell them I'm for real," he warned a young man who was released as a hostage at B'nai B'rith. "Tell them if they don't do what I want, some heads are going to roll."

The demands were as bewildering as the lightning raids the hanafi men pulled off between 11 a.m. and 3 p.m.

Stop showing a recently released movie on the life of Muslim Prohet Mohammad. Deliver to Khaalis the seven black Muslims accused of murdering his family in 1973. Pay him back a $750 contempt-of-court fine a judge levied against Khaalis for disrupting the black Muslims' murder trial. Summon the Arab ambassadors to a meeting to arouse the Muslim nations of the world.

To the extent that any outsider could understand the anger behind this three-pronged attack, it seemed to originate in a bitter sectarian feud between two groups that are both black and call themselves Muslim - the Hanafis, who consider themselves orthodox, and the nation of Islam, followers of the late Elijah Muhammed, better known as the Black Muslims.

Four years ago, seven members of Khaalis's group, including five children, were murdered at their Hanafi Muslim home on upper 16th Street NW. Seven members of the Black muslims were later indicted and tried for the murders, but the Hanafi survivors have been bitterly disappointed in the conduct of justice in the case. Five of the defendants were convicted and sentenced to long prison terms, 140 years each; another was acquitted by the judge, and the last won a mistrial and now awaits another trial.

In his scattered telephone comments to police and reporters yesterday, Khaalis returned belligerently again and again to that bloody episode at his 16th Street home. At one point, he told WTOP-TV newsman Max Robinson:

First thing, I want the killers of my cabies . . . I say we want them right here. I want to see how tough they are. I want the one who killed Mclcolm, too (the late dissident Black Muslim leader Malcolmn X)."

Khaalis would not say what he had in mind. But, at all three locations buildings taken over by the gunmen, witnesses and hostages heard similar bloody threats.

It is simply not clear yet why these three particular locations were chosen by the raiders. The closest things to an explanation for the B'nai B'rith seizure were comments from Khaalis, complaining that "Jewish judges" were letting criminals go free, and a complaint from a Hanafi follower that "Zionist Jews" are behind the Black Muslims.

The explanation for attacking the Islamic Center is even more sketchy. In 1973, when the Hanafi murders occured, an Islamic Center official was quoted in this newspaper as describing the Hanafi's knowledge of Islam as "superficial." The official later disclaimed the remark in a letter to the editor.

Incredibly, as best as anyone could establish, there are only eight men behind the drama that terrified scores of people, tied up the capital's entire law-enforcement apparatus and grabbed the attention of the world.

There was irony in the timing of the Hanafi raids. Less than an hour before the B'nai B'rith building was occupied, President carter had told a televised news conference that he had agreed to speak personally by telephone to an Ohio man who had taken hostages the day before and had demanded Carter's attention.

No such demands came from the Hanafis. The federal government nevertheless quickly got involved. Carter ordered in the FBI, and special security measures were ordered into effect all over the city. The police strategy, as in most recent hostage dramas, was patience, negotiations and no gun-play.

The Hanafis - four of them struck first about 11 a.m. at the B'nai B'rith national headquarters building, an eight-story concrete office building at 17th and Rhode Island Avenue NW - six blocks northwest of the White House.

The men came into the B'nai B'rith building with machetes and guns, attacking people on the side-walk and in the lobby, shooting and pistol-whipping as they rounded up the building's occupants floor by floor. Andrew S. Hoffman, a 20-year-old student from George Washington University, who was swept into the fracas while passing by the building, guessed there were 100 or so hostages before some were released.

"They had big huge swords," Hoffman said after being released by the invaders. "They kept saying they were gonna cut people's heads off . . . They all said they were going to die, but they were going to die for a cause."

The B'nai B'rith prisoners were herded up to the eighth floor where khaalis ordered the narrow windows blocked or painted over. At least 20 hostages were released after at least one was questioned about his religions identification. Hoffman said the gunmen made him carry their ammunition upstairs, then asked about his family background."I'm half Jewish and half Italian," Hoffman said, "but I wasn't going to tell them I was Jewish. I told them I was Italian and they let me go."

About half an hour later, the second strike occured - at the Islamic Center on Embassy Row. This time two gunmen were involved and their hostages - claimed to be 15 people - included members of the center's staff, plus at least two people from a touring group of foreign students who just happened to be going through the mosque.

Then, at 2:40 p.m., the bloodiest adventure of the day began at the District Building - barely two blocks from the White House. Two black men, armed with shotguns, strode into the building where Mayor Walter Washington and city Council members were at work. They took an elevator to the fifth floor, where the Council offices are located, stepped out into a corridor and blasted away.

Maurice Williams, a reporter for radio station WHUR, fell to the floor mortally wounded. He cried out: "I'm shot!"

Councilman Marion Barry staggered into the Council Chamber and fell into a chair, clutching his bloody chest. He, too, cried out: "I've been shot, I've been shot."

There were two other casualties: Mack Wesley Cantrell, a 51-year-old security guard, who was dropped by a shot in the head, and Robert Pierce, also 51, who was critically wounded.

The gunmen then moved down the corridor to the quarters of Council Chairman Sterling Tucker and his staff and herded hostages inside.

Mayor Washington and other officials and employees locked themselves in their offices while awaiting rescue. The mayor finally go out with a heavily armed escort after 6 p.m. A little more than an hour earlier, he had been a potential pawn in the game the gunmen were playing.

The gunmen were reached by telephone in Tucker's office at 4:55 p.m. by Douglas Watsona reporter for The Washington Post. Watson was told, "We want the mayor. We're going to give three women for the mayor . . . That's all. That's all we've got to say."

People said there was no question that the occupation of the B'nai B'rith building and the Islamic Center were coordinated actions by the Hanafis. They were less sure that the men holding hostages in the District Building were also involved with the group.

However, a man identifying himself as Michael Adams called WTOP-TV late yesterday to say that his brother, David, is a Hanafi Muslim and was one of the men holding hostages in the district Building. He said David had left a note at his home saying, "Today is going to be the most inspirational day of my life because today is my final challenge."

Throughout the day there were telephone conversations between the Hanafis and various news people and police officials. And the news media made the most of it.Television stations interrupted their afternoon game shows and soap operas with frequent bulletins and live coverage from the various scenes of action.

In the heart of the city, the afternoon rush hour crawled. Streets and avenues were cordoned off by police. Sharp-shooters were posted on building tops and police helicopters hovered over homebound commuters. Scott Circle was a gathering point for the curious, but the spectators heeded the police warnings to stand back, out of rifle range. None of the crowd seemed terrorized by the drama, merely curious.

Extra security measures were begining to be taken around the city by midday. About 3 p.m., security guards closed D.C. Superior Court and the U.S. District Court to the public. Judges cut short trials and ordered court personnel to go home.

The special tactical unit officers of the federal Protection Service were sent to the federal courthouses about 3 p.m. and were joined soon after by about 15 Metropolitan Police officers at the building's single open entrance.

"We're prepared for an assault on the courthouse," said U.S. Marshall George McKinney.

The police theorized the courts could become targets because there was some indication of who the terrorists were. At 2:55 p.m., a Post reporter got through on the telephone to the mosque. The man answering talked about the 15 hostages there and, when asked who he and his group were, replied: "We're with the Hanafi Muslim community." Then he hung up.

Max Robinson of WTOP-TV conducted dramatic interviews in person at the 16th Street Hanafi house and by telephone on the air, in which he gently coaxed information out of the angry Hanafi leader and endured his upbraidings. At the Hanafi house at 16th and Juniper Streets NW, he was given a hand-written instruction that apparently came from Khaalis.

Among other things, the note directed the television newsman to contact Secretary of State Cyrus Vance "because we are going to kill foreign Muslims at the Islamic Center . . . It will create an international incident." He was further told to call the ambassadors from all Islamic nations.

The message ended: "Seven died for the faith in 1973."

Later, while television viewers listened, Robinson conducted a live telephone interview with Khaalis on Channel 9, in which the Hanafi leader stressed his outrage at the movie, "Mohammad, Message of God." The film opened yesterday in New York theaters but was stopped quickly in mid-screening when New York police relayed a request to the United Artist distributor.

Strangely enough, the movie has not only been approved by other Muslims who have seen it, but its financing - $10 million for production - comes from one of the most volatile of Arab leaders, Col. Muammar Quaddafi, strongman of Libya and alleged sponsor of several Arab terroist episodes in Europe.

Khaalis declared to Robinson: "We want the picture out of the country."

Why? "Because it's a fairy tale, it's a joke," Khaalis told the reporter. "You talk for all the American people, but I'm Muslim and I'll die for my faith. It's a joke. It's misrepresenting the Muslim faith."

In New York City, the Egyptian consul general received a telephone call from one of the hostages at the mosque in Washington, pleading to have the showings of Mohammad film stopped. "Please help us," said Dr. Muhammad Adul Rauf, the center director. "You and all the Muslim ambassadors must do all you can to stop showing the film."

Morris Goldschlagger, vice president of United Artists Theaters Circirt, said the movie - screened and approved by other Muslim groups - is "like the Life of Jesus." But he added: "We will not be showing it as long as there is any possibility of violence."

A more difficult problem facing the authorities last night was the Hanafis' demand to be handed seven Black Muslims accused of the 1973 Hanafi murders. It was, of course, unikely that officials would turn these men over to them.

That was one of the dilemmas facing Washington late last night, as the impasse continued with no sign of any resolution or weakening of the Hanafi resolve.