A little girl leaving her aunt’s home on Valentine’s Day had just opened the door to the apartment building for two men, District police said, when minutes later six gunshots rang out. Children who were in the apartment complex’s courtyard ran, pointing and screaming, “There they go!” as the men fled, according to a detective.

One of the children who ran was the 8-year-old girl who had opened the door. She had been struck in the upper left chest by a stray bullet, police said.

On Saturday, as the girl remained hospitalized in critical but stable condition after surgery, D.C. police charged two men in the shooting that occurred about 3 p.m. Friday in the 1200 block of Valley Avenue SE.

Karie Brown, 19, of the 1900 block of Valley Terrace SE and Nathaniel Patten, 21, of the 2900 block of Erie Street SE were each charged with assault with intent to kill while armed, police said. They also were charged with aggravated assault while armed and unlawful possession of a firearm.

Police say Brown told them that he and Patten were at the building to buy $100 worth of marijuana.

Officer Hugh Carew, a police spokesman, said the two men are the only suspects in the shooting but that the investigation is continuing.

“We don’t believe she was the intended target,” Carew said.

The girl was identified by her grandmother as Makayla Darden. The grandmother, Beverly Darden, said Friday that Makayla, a third-grader, was walking home after visiting her aunt when she was shot.

According to charging documents in the case, a witness gave police the following account:

About 3 p.m. Friday, the witness heard a single gunshot, then five more, near the apartment building at 1241 Valley Ave. A group of children who were outside the building, including Makayla, ran from the area. Makayla had been shot.

The children shouted, “There they go!” and pointed at two men running through the courtyard at a slow trot. One of the men tried to pull something over his face as he ran down Wheeler Road.

The witness identified the two men — Brown and Patten — in the 3500 block of Wheeler Road about six minutes after police arrived at the scene, according to the charging documents.

A second witness told police that Makayla was just leaving the apartment building when two men entered and walked up to the second floor. Moments later, the second witness said, there was an argument in the upstairs hallway, as if someone were being robbed. Among the male voices, the witness recalled hearing, “Man, I ain’t got nothing,” “I don’t have any keys” and “Come up off that.”

The second witness heard a single gunshot come from inside the building, that witness told police. A few moments later, the witness said, a man wearing a black jacket and white pants fired a gun several times as he and another man stood outside the building. It appeared that the man was firing at someone running away, the witness told police.

The second witness said Brown was the one who fired the shots outside, according to charging documents.

Brown later told police that the child who was shot was the one who had opened the apartment building door for him and Patten, according to court documents.

Police said they recovered one .22-caliber cartridge casing inside the building and five others outside. They said they also found a .22-caliber pistol on the ground near where Brown and Patten were stopped on Wheeler Road, according to the documents.

Brown told police that he and Patten, who also goes by the nickname “Psycho,” went to the second floor of the apartment building to buy an ounce of marijuana for $100 and encountered a man with a gun, charging documents state. Police said that Brown told them that the gun fell to the floor during a struggle inside and that Patten picked it up and fired at the man. As the man ran from the building, Brown said he took the gun from Patten, left the building and fired multiple shots outside at the same man, according to police.

Police wrote that Brown and Patten each had black face masks but no money with them when they were stopped.

In court Saturday afternoon, where Brown and Patten were held on charges, Dana Page, a public defender representing Patten, argued that Patten should be treated differently from Brown.

“I don’t think that there’s anyone within the four corners [of the incident] that identified Mr. Patten as having shot,” Page told D.C. Superior Court Judge William Jackson. “There’s nothing that indicates Mr. Patten ever had a gun, shot a gun.”

Jackson said there was evidence that both men “touched or held” the gun.

Brown has previously been convicted in the District of assault with a dangerous weapon, while Patten had previously been convicted in Maryland of conspiracy to commit robbery, according to the charging documents. Details of those cases were unavailable Saturday.

Brown was represented in court Saturday by attorney A. Kevin Fahey.

Julie Tate and Clarence Williams contributed to this report.