Armed with as many as three weapons -- one borrowed and the others owned -- the five teenagers were out to settle a simmering, two-week old dispute with members of a rival group in Northwest Washington.

With a 14-year-old at the wheel, the five drove to Shaw Junior High School Thursday afternoon, looking for their targets. About 3:30 p.m., on the corner of Fifth and O streets NW and just six blocks from the school, the teenagers found the young men they were looking for.

From inside the car they fired their weapons at their rivals, three or four teenagers standing in front of a picket fence, police said. Five were wounded, including a 6-year-old girl who happened to be standing nearby.

"From what we have been able to tell, they didn't care who in the group they hit," said one police official.

Yesterday, as police announced the arrest of three juveniles, one 16 and two 14, on charges of assault with a deadly weapon, details of what Police Chief Isaac Fulwood Jr. called a "heinous act" began to emerge. Far from being an indiscriminate act of violence, the shooting was the culmination of a dispute between rival teenagers who belong to "loosely knit" groups, Fulwood and others said.

Those in custody were arrested between 1:30 and 6:30 a.m. at their homes after an intensive investigation that officials said hinged on the cooperation of the principal at Shaw, Percy L. Ellis. The break came when 1st District detectives learned the nicknames of the suspects and took the list to Ellis about 1 a.m., one source said.

With the help of his staff, Ellis matched the nicknames to names of students. Some of the suspects were roused from sleep by police officers.

Two other teenagers, both 14 years old, are still being sought. Those arrested yesterday have been charged with five counts of assault with a deadly weapon. Police are searching for the car, believed to have been stolen, and no guns have been recovered.

Two of the injured, Azelia Paul, 6, and Troy Gray, 15, were discharged yesterday from Children's Hospital, where all the victims had been taken. Conditions of the two most seriously injured, Clarence Richmond, 14, and John Olden, 13, were upgraded to fair. Brian Lewis, 15, was listed in good condition.

Stacye Lewis, Brian's mother, said, "He doesn't really know what happened, who shot him, or why."

She said her son told her that at first he didn't know he'd been shot. "He kept getting up and falling down. Somebody pulled all of the kids into one of the town houses and checked them to see where the blood was coming from."

Azelia Paul, munching on corn chips back at her house -- her right wrist in a bandage -- said, "I was waiting on my friend to come out of school. I tried to run. I don't even know where. I ran into my friend's house. I saw blood on my hand. I was scared and crying."

Asked if she was still scared, she nodded yes.

A battle over turf, not drugs, the conflict between the two groups had simmered for about two weeks, police sources said. Several of the rivals attend Shaw -- it was not clear how many -- but all have ties to the groups, one based in LeDroit Park, near Second and V streets NW, and the other in Shaw, around Fifth and O streets NW, one senior police official said.

On Wednesday, a student tried to fire a gun outside school but it jammed, said D.C. school board member R. David Hall (Ward 2). Thursday afternoon, someone called the police to say that a dispute was about to erupt, predicting there would be a shooting when school let out, a police official said. Officers went to the school, and that apparently drove the teenagers from the area. Ellis declined to be interviewed.

Fulwood declined to describe what he called the "altercation" between the young men, but other sources said it was a fight over turf. Detectives first were told that there had been a dispute over a jacket, one source said, but apparently the shooting involved a broader argument, sources said.

At the school yesterday, police officers stood watch as students left for the holidays. It had been a tense day. The victims are well-known, and there were plenty of rumors.

Several students said teachers spoke to them about avoiding two rival groups feuding around Shaw this fall. Students said there has not been trouble inside the school, aside from pushing and shoving, because everyone is searched for weapons each morning.

"There are just too many guns on the street," Hall said. Ellis "has them empty their pockets and pats them down to check for anything."

At a bus stop near the school, four ninth-graders said the rival groups usually stand on opposite corners after school. At times, members of a group wear the same colors to identify themselves.

"They're not out here today, but come back in a few weeks, and you'll see them again, just staring back and forth," one of them said.

"That's all they do, always staring," his friend interrupted.

"They're in my classes, so I'm cool with both sides," said another.

"Don't put in the paper it's over drugs, or a girl," said the first ninth-grader. "It's just about their streets. They don't like each other. And they fight over simple stuff, like this."

He crossed the sidewalk, bumped deliberately with no expression into his friend, then kept walking with a chuckle. "Simple as that," he said.

Staff writers Patrice Gaines-Carter and Keith Harriston contributed to this report.