The crew from Wellington Park had been planning a drive-by shooting in rival Clay Terrace turf for weeks, police say, even buying a stolen car to use. On the afternoon of July 16, it was time to recruit some gunmen.

“Let’s Go Do Wat We Do,” one leader texted a friend. There was a reminder to bring the “100 Roun” — a gun capable of holding 100 rounds of ammunition. And an admonition that one member “better not be scared.”

At 6 p.m., a text announced it was time to “go put some work in.”

Two hours later, four masked shooters leaped from a carjacked Infiniti and sprayed a crowded D.C. courtyard with gunfire. Five people were struck, including 10-year-old Makiyah Wilson. The bullet pierced her heart, killing her as she clutched a $5 bill her family gave her to buy a treat from an ice-cream truck.

As an innocent child’s death has prompted outrage, city leaders, residents and Makiyah’s family have struggled to understand what could have sparked such a burst of indiscriminate violence. The first court documents in the case reveal no simple answers; rather, they describe long-standing feuds among D.C. neighborhoods, easy access to weapons and relationships among young men who often have been perpetrators or victims of violent crime.

Two suspects arrested Saturday and Monday — Qujuan Thomas, 20, and Quentin “Q” Michals, 21 — made their initial appearance Monday at a chaotic hearing in D.C. Superior Court. Each is charged with first-degree murder.

As the shackled defendants entered the courtroom, Makiyah’s father, wearing a T-shirt with a photo showing him hugging his daughter, stood up, prompting U.S. marshals to ask him to take a seat. The girl’s mother, Donnetta Wilson, yelled out: “She was only 10 years old! My baby was only 10!” Marshals quickly ushered her out of the courtroom.

About 30 members of Makiyah’s family took seats on one side of the courtroom. One carried a large poster with photos of Makiyah. At one point, a man yelled “What are you smiling at?!” to Thomas as the defendant turned around and looked at the audience.

A relative of Thomas yelled back: “He’s innocent! He didn’t have nothing to do with this! He’s allowed to smile!”

Marshals ordered relatives of both defendants and of the victim to leave the courtroom.

When the hearing resumed, attorneys for Thomas and Michals said the case was based on “speculation.” Michals’s attorney argued that the evidence showed only that her client may “have associated” with those involved in the shooting. Court documents say that Thomas “made statements indicating that he actually participated in the shooting” and allege that while Michals was not at the shooting scene, he helped plan the attack.

The judge ordered both men detained until their next hearing, Sept. 11.

Details of the July 16 killing of Makiyah were included in a 38-page arrest affidavit filed Monday. The documents describe the alleged planning of the shooting and the violent histories of the crews from Wellington Park and Clay Terrace. D.C. authorities mention three other killings in 2017 and 2018 that police say have links to Wellington Park, a neighborhood near Barry Farm in Southeast Washington. One victim, a man shot a week after Makiyah’s death, is identified as a person who helped get the vehicle used in her shooting.

According to the court document, police still do not know precisely what started the latest argument. Michals had been wounded in a shooting in October, but it is not clear whether that was a primary instigation, even though people from Clay Terrace were believed to be involved.

Police said that after Makiyah’s death, an unnamed informant told them that one of the men involved in the shooting said: “They didn’t even see her. They didn’t mean to shoot her.”

The court document shows a detailed investigation that relied on DNA, text messages and intercepted jailhouse phone calls in which police said the shooting was discussed in coded language as a terrorist attack. Police relied on social media postings of suspects holding guns and evidence found in the abandoned Infiniti that included a rifle bullet, found in the railing along the front passenger seat, and two 9mm cartridge casings found under a wiper blade and on a rear floorboard.

They all matched casings found at the shooting scene, the affidavit says.

Authorities said that some of the guns used in the July 16 shooting had been used in other violent incidents, including shootings in Southeast dating to May 2017. In other incidents, men connected to the crews have been killed.

In May 2017, a man named Carl Hardy told police that gunshots heard in Potomac Gardens “were for me,” and while he later denied saying it, he was shot and killed in that community in September. Police charged two men from Wellington Park in the killing — one of them Michals’s brother.

In October, Michals and another man were shot when a car pulled up alongside them and someone opened fire, according to the document. No arrests have been made.

The police affidavit shows that in recent weeks the Wellington Park crew planned a drive-by shooting. They needed a vehicle, police said, and they learned a man named Kevin Eugene Jones had one. Police said he had taken a black Infiniti at gunpoint from a Maryland woman several weeks earlier.

The affidavit says Jones was close with a Wellington Park crew member who had been fatally shot in December. Police said in the document that Jones brokered a deal through Monshae “Shay” Burroughs to sell the Infiniti to Wellington Park associates.

Jones’s alleged cut was $125. He was arrested Aug. 8 and charged with armed carjacking after police said they found his DNA on a white headband left in the Infiniti after the shooting in Clay Terrace. Police said Burroughs was fatally shot July 23, eight days after Makiyah’s death. No arrests have been made in Burroughs’s killing.

The morning after the girl was killed, police said, Michals searched various terms on Google looking for news coverage of the shooting, including “shooting in dc clay street.” He clicked on a WTOP story titled “10-year-old dead . . . ,” the affidavit says.

Within days, police said, they listened to phone conversations between Thomas and an inmate at the D.C. jail. The affidavit alleges the two talked about the Clay Terrace shooting using coded language. Police said that “terrorist attack” at the Pentagon was code for the July 16 shooting and that “they” found “the airplane,” referencing the recovered Infiniti.

Clarence Williams and Dana Hedgpeth contributed to this report.