A 16-year-old Fairfax County boy was lured to a park, beaten to death and buried because his alleged killers believed he was a gang member who had used sorcery or black magic on a 16-year-old girl, a detective testified at a preliminary hearing Wednesday.

Armando Dagoberto Reyes Reyes, 27, formerly of Alexandria, said after his arrest on murder and abduction charges that Richard Hernandez Cruz had caused the girl, whom Cruz was dating, to lose 45 pounds and suffer other problems by casting a curse on her, the detective testified in Fairfax County juvenile court.

“He believed the victim used sorcery or black magic to control [her], so the victim had to be ended,” Fairfax County Detective John Farrell told a judge.

Farrell’s testimony Wednesday was enough for Judge Janine M. Saxe to certify the case to go to a circuit court grand jury. In addition to Reyes Reyes, two other men and the 16-year-old girl have been charged in connection with Cruz’s bizarre and violent slaying in North Hill Park, in the Hybla Valley section of Fairfax County, in April or May.

The events began to unfold on April 22. Dora Cruz Ramirez testified that her son left their apartment in the Lincolnia area that afternoon to play soccer. Around 10:30 p.m., she testified, she got a text from his phone saying, “I’m coming now, ma.”

But Cruz Ramirez never saw her son again and reported him missing. When prosecutors flashed a photo of the boy on a projector in the courtroom, she burst into tears and placed a tissue to her face.

Reyes Reyes told detectives after his arrest that the 16-year-old girl was having problems with Hernandez Cruz, whom she was dating, Farrell testified. Reyes Reyes was a friend of hers and went online to research Hernandez Cruz. The Washington Post is not naming the girl, because it generally does not name juveniles charged with crimes.

Reyes Reyes discovered information that led him to believe Hernandez Cruz was a gang member, Farrell testified. Farrell did not say which gang Reyes Reyes thought Hernandez Cruz was affiliated with or whether the information was accurate.

Reyes Reyes also came to believe Hernandez Cruz employed magic to “use” the girl so he and his friends could have sex with her, Farrell testified. Sometime in late April or May, Farrell testified, the 16-year-old girl lured Hernandez Cruz to North Hill Park.

Reyes Reyes met Hernandez Cruz there with the girl and other individuals, Farrell testified. Reyes Reyes “ordered” Hernandez Cruz into the woods. Reyes Reyes’s account of the events that followed changed over time, Farrell testified, but he told detectives he confronted Hernandez Cruz about ending the black magic.

Reyes Reyes told detectives Hernandez Cruz eventually admitted to putting a curse on the 16-year-old girl and a confrontation ensued, Farrell testified. Reyes Reyes told detectives he had been a street fighter in his native El Salvador.

During the fight, Reyes Reyes told detectives that Hernandez Cruz was punched, stomped and hit several times with a baseball bat. At one point, Farrell said, Reyes Reyes said that he never meant to kill Hernandez Cruz but that things spiraled out of control. Hernandez Cruz suffered devastating injuries to his face and head.

Afterward, Reyes Reyes and others returned to the park with a pickax and shovel, spending the better part of a day digging a grave for Hernandez Cruz, Farrell said. They smashed his body with concrete blocks and hacked it with a machete to get it to fit in the hole, Farrell said.

Cesar Antonio Ochoa Carillo, 20, of Alexandria and Dorteo E. Diaz Martinez, 19, of no fixed address were charged with unlawful disposal of a dead body. In addition, Ochoa Carillo and the teenage girl were also charged with gang participation. Ochoa Carillo’s attorney declined to comment, and Diaz Martinez’s attorney did not respond to requests for comment.

Fairfax County police announced at a news conference on May 23 that they had unearthed a body in North Hill Park, following a spring initiative to interview gang members that yielded a tip that a body was buried there.

At the time, Col. Edwin C. Roessler Jr., Fairfax County’s police chief, said there was a “high probability” the case was gang-related but declined to name the group involved, because of a department policy of not giving gangs publicity.

In the weeks that followed, Fairfax County police identified Hernandez Cruz as the victim but declined to make the information public, because of a 2017 Virginia law that bars authorities from naming juvenile crime victims without the consent of parents.

Ochoa Carillo and Diaz Martinez were charged in April, and Reyes Reyes was charged in July with murder. In an unusual move for a high-profile slaying, police did not publicly announce the charges until Wednesday, after The Post published a report revealing the charges had been filed.

“We didn’t put it out because we had a lot of investigative leads that would have been jeopardized by making the information public,” said Capt. Eli Cory of the Fairfax County police.

Farrell testified Wednesday that Reyes Reyes had fled to Florida after learning from the juvenile charged that police were asking questions about the case. He was returned to Fairfax County last month to face charges. Farrell testified that Reyes Reyes has not been willing to name other people who took part in the killing.

Corinne Magee, an attorney for Reyes Reyes, sharply disputed the idea in court that Hernandez Cruz had been abducted but declined to comment after the hearing. Hernandez Cruz’s mother also declined to comment.

Maria Sánchez and Michael E. Miller contributed to this report.