A girl who was 13 when she admittedly took part in the fatal carjacking of a food delivery driver in the District was ordered Tuesday to remain in the custody of the city’s youth-rehabilitation agency until she turns 21, the same sentence imposed last month on a 15-year-old girl who also pleaded guilty in the case.

Calling the crime “terrible” and “devastating” for the victim’s family, D.C. Superior Court Judge Lynn Leibovitz rejected a defense lawyer’s request that the teenager’s commitment to the Department of Youth Rehabilitation Services (DYRS) end on her 18th birthday.

The girl, now 14, “needs very intensive services,” Leibovitz said, agreeing with a prosecutor who argued that the girl, like her 15-year-old accomplice, should remain under DYRS supervision for the longest term allowed by law. In a brief statement, the sobbing girl told the judge, “I never meant to do it,” and promised, “I will change.”

Authorities said the girls, armed with an electronic stun device, carjacked a Honda Accord owned by an Uber Eats driver near Nationals Park on March 23. The 66-year-old victim, Mohammad Anwar, a Pakistani immigrant, was “hanging outside” the speeding car during a struggle and suffered fatal injuries in a crash, police said.

The girls were charged with numerous crimes. In deals with prosecutors, the 15-year-old, who was in the driver’s seat when the crash occurred, pleaded guilty to felony murder, and the younger girl pleaded guilty to second-degree murder.

Because they were charged as juveniles, they were not publicly identified and their court hearings were closed to the public. Journalists were allowed to watch the hearings after agreeing not to report identifying information about the girls.

Under D.C. laws governing the prosecution of juveniles, the younger girl could not be charged as an adult. Prosecutors could have asked a judge to move the 15-year-old girl’s case to adult court by arguing that she is not amenable to rehabilitation, but they opted not to do so.

Because the juvenile court’s focus is entirely on rehabilitation, the maximum sentence each girl faced was DYRS custody until age 21. It is up to the agency to decide whether either girl will be confined to a detention center.

At the 15-year-old’s sentencing June 4, Anwar’s loved ones voiced their grief. “You did not kill one person,” his daughter said. “You killed a whole family.”

The relatives did not speak Tuesday but submitted written statements to the judge.

“She made terrible choices,” Leibovitz said of the defendant. “I’m very hopeful that the services of DYRS will help her.”