A young man arrested in connection with a Metrobus shooting in Southeast Washington last month was a passenger who police say was engaged in a shootout with a man who was outside the bus, according to court documents.

Police said in an affidavit that the 20-year-old suspect, Bijon Brown, exchanged gunfire with a friend of a person Brown had shot in February, a crime for which he served four months in jail. Police said people targeting Brown forced the bus to stop and disabled it before the gunfire started, causing the driver to flee into the woods and leaving frightened passengers behind.

One of Brown’s friends was wounded in the shootout that sent one bullet through the bus windshield and two into the front side door. Brown denied to police that he fired his gun, but admitted having one on the bus, according to the documents. It was not clear who authorities think fired the shots that injured the victim.

The court documents provide new details on what led to the Aug. 21 shooting, which occurred shortly before 11 p.m. in the 2500 block of Elvans Road SE and prompted Metro officials to briefly detour buses away from the block.

The incident thrust Brown into the center of the District’s discussion over repeat offenders when D.C. Mayor Muriel E. Bowser (D) publicly labeled him an example of the type of offender driving a summer crime wave. She urged that his four-month sentence in the February shooting be examined.

Bijon Brown (Courtesy of Metro Transit)

A. D.C. Superior Court judge on Thursday ordered Brown detained until a preliminary hearing Sept. 25. He is charged with assault with a dangerous weapon and unlawful possession of a firearm. His attorney in prior cases, Geralyn R. Lawrence, did not return repeated calls to her office over the past two weeks. Brown’s attorney in the bus case, Roderick Thompson, with the Public Defender Service, declined to comment Friday.

Brown grew up in Barry Farm, one of the most dangerous neighborhoods in the District, and was repeatedly targeted for beatings, Lawrence wrote in court papers filed in the previous case.

In 2013, Brown was stabbed in the back and chest when he failed to outrun his attackers, Lawrence wrote. She said he was beaten again Feb. 16, the same day he fired on two youths as they walked to a store and crossed a basketball court. One was wounded.

Brown was arrested in that case and agreed to plead guilty to a charge of attempted assault with a dangerous weapon. Prosecutors did not oppose a sentence of probation; Brown served four months in jail between the time he was arrested and sentenced. At the time, Lawrence noted that Brown had a 3.3 GPA in high school and reenrolled to earn college credit. Brown also confessed to the shooting and expressed remorse.

Prosecutors said they took those factors into account, and added that the victim refused to cooperate. Brown was freed from jail on probation in July. The bus shooting occurred one month later.

Brown told police that he was aboard the bus with two friends and that he had taken a handgun with him “for protection because it was nighttime and he did not know what would happen,” according to the police affidavit.

As the bus approached a stop on Elvans Road, someone stood in the street and forced the driver to halt, according to the court papers. A surveillance camera inside the bus showed other passengers appearing startled as a group of people swarmed the front of the vehicle. Officials said one person disabled the bus, which can be done from the outside.

Police said one person peered into the bus through the front window and gestured at Brown, who told police that person was a friend of the teenager he wounded in February. Police said the two exchanged words through the door and then exchanged gunfire. A Metro spokesman said Brown was arrested Wednesday hiding in a closet in the house of his wounded friend’s mother.

Brown, according to court documents, admitted to having the gun but said he never shot it. Police rejected his claim of self -defense, saying in the affidavit that Brown “placed himself in a position that was likely to provoke violence, armed himself with a weapon and therefore cannot justifiably claim self-defense.”