A former juvenile delinquent fatally shot an armed robber who broke into his apartment through a bathroom window and accidentally shot and killed his visiting teenage brother and his housemate while exchanging shots with the intruder, a district attorney said Wednesday.

Meiko Devaughn has been charged with illegally possessing a firearm, drug possession and receiving stolen property.

Devaughn, who police said was in the "drug business," shot at 25-year-old Kadeem Williams after Williams climbed into the apartment Devaughn shared with Akeilah Solomon at about 3:20 a.m. Monday, said Stephen Zappala Jr., the Allegheny County district attorney.

As the two fired shots at each other, Devaughn, 22, also struck the 20-year-old Solomon and his 16-year-old brother, Jaimill Kenney, with bullets, killing them. Williams was mortally wounded in the exchange but managed to run outside before dying, Zappala said.

It's not clear whether Devaughn will face charges for the shootings, Zappala said, because the investigation is continuing.

"We have to know all the evidence first," the prosecutor said at the scene Tuesday. "You're entitled to protect yourself."

The county medical examiner determined Solomon was shot once in the head, while Kenney and Williams were shot once each in the chest. Kenney was visiting his brother.

Devaughn was adjudicated delinquent, the juvenile court equivalent of a conviction, in 2009 on charges including robbery and aggravated assault. That's why it was illegal for Devaughn to possess the .40-caliber Glock pistol he used, according to a criminal complaint. The gun had been stolen from neighboring Butler County.

Police believe Williams was trying to rob Devaughn because $1,000 worth of marijuana and $14,000 cash were found in the apartment, police said.

Zappala said investigators believe at least one other intruder may have been involved. They didn't find a gun near Williams' body outside the apartment complex but did find shells from a different caliber weapon at the scene, he said.

Online court records don't list an attorney for Devaughn, who was in custody awaiting arraignment Wednesday.