James Mayfield, 18, is charged with murder in the deaths Jermaine Phillip Bowens, 38; Elijah Henry, 21; and Jamahri Sydnor, 17. (D.C. police)

An 18-year-old sought by District police in the killing of a college-bound teenager who was struck by a stray bullet in August was arrested Wednesday, hours after authorities said he fatally shot two men in Northeast Washington.

Police said James Mayfield, of Northeast, was arrested after an alleged attempt to rob a person while wearing a mask about six hours after the latest shooting. He has been charged with three counts of murder, attempted robbery and illegal handgun possession. On Thursday, he was ordered detained until a preliminary hearing Jan. 11.

His attorney, Veronice A. Holt, could not be reached for comment.

Police said Mayfield is suspected in three other armed robberies in a 30-hour span this week. "We have a person who has really in a lot of ways terrorized a community," Mayor Muriel E. Bowser (D) said Thursday.

Mayfield was the third and final suspect sought in this summer's shooting of Jamahri Sydnor, 17, who was hit by a bullet as she drove in Brentwood in Northeast Washington. Police have said the gunmen were aiming at four men across the street as part of a neighborhood dispute.

Jamahri Sydnor was hit in the head by a stray bullet as she passed through a Northeast Washington intersection in August. (PH/A?Mee Barnes)

According to an arrest affidavit filed in court, a witness told police that he had confronted Mayfield about Sydnor's killing and that Mayfield responded, "She got in the way."

Sydnor's death was a personal blow to the police department — she was the daughter of a veteran sergeant — and a loss to the District of an accomplished youth. She had been captain of her Woodrow Wilson High cheerleading team, served as a peer counselor, sang in the school choir and was days away from heading off to study at Florida A&M University.

D.C. Police Chief Peter Newsham declined to discuss a motive in the two killings from this week, but he took note of the young suspect's quickly growing arrest record. "It's a good example of how one person can cause so much violence in our city," the chief said.

The shootings and robberies occurred in a string of neighborhoods in Northeast — Brentwood, Langdon Park and Fort Lincoln — between New York and Rhode Island avenues.

Sydnor was shot about 3:30 p.m. on Aug. 10 in the 1400 block of Saratoga Avenue NE. Police said a man drove two gunman to the street, where they hid in bushes and then fired on four men standing across the street, using .40- and .45-caliber handguns.

Police said that Mayfield and the others were in a crew that identified with Langdon Park and were feuding with another group associated with the area around Saratoga Avenue. A witness told police that before the shooting that killed Sydnor, the gunmen had accosted a man from the Saratoga group who had pulled out a gun and shot at them. The Aug. 10 shooting, the witness said, was retribution for that encounter.

Police quickly arrested Philip Carlos McDaniel, 21, who they said was the driver, and in October they arrested Robert Moses, 18, who they said was one of the gunmen. Court documents in that case identified Mayfield as the third suspect, and police released his photo in early November. Newsham said police, including an elite fugitive task force made up of officers from several local and ­federal jurisdictions, actively searched for Mayfield. Police said the suspect changed his appearance; court documents say he cut off his dreadlocks.

It was not clear Thursday why Mayfield suddenly surfaced in what authorities describe as a burst of violence in Northeast Washington.

Mayfield's relatives could not be reached. Court documents say the suspect told police that he had developmental problems and had only a third-grade education. But police said they confirmed he attended the 10th grade at Metropolitan High School and the 11th grade at Dunbar Senior High. He also told police that he had taken the hallucinogenic drug PCP and had Xanax and Valium on him.

On Tuesday, police said Jermaine Phillip Bowens, 38, was shot in the legs in the 2200 block of Douglas Street NE. His injuries were initially described as not life-threatening, but he died shortly after midnight the next day. Police said in an arrest affidavit that ­Bowens was able to say that he was attacked by a man dressed all in black and wearing a mask. The gunman said something before he opened fire, Bowens told police, but he was unable to articulate what was said, according to the court document.

On Wednesday, police said Elijah Henry, 21, was shot in the head about 5:15 p.m. by a gunman inside a residence in the 1800 block of Bryant Street NE, five blocks from where Bowens had been shot. The arrest affidavit says Mayfield was in a house with several people, including the victim's mother, and smoking marijuana when an argument broke out over either a missing coat or $200 that was missing.

Police said that Henry was shot during the dispute and that witnesses identified Mayfield from a flier printed up in connection with Sydnor's death. "That's him, right here," a person told police, according to the affidavit. "That's Jamo. He ain't got no dreads no more."

Correction: This story was updated to correctly spell the name of Veronice A. Holt, the defendant's attorney.

Clarence Williams contributed to this report.