A 12-year-old Fort Washington boy on Wednesday was convicted in juvenile court of involuntary manslaughter in the beating death of a 2-year-old foster girl living with his family.

The boy had admitted to a detective that at least six times he hit Aniyah Batchelor, who suffered internal injuries, Prince George’s Assistant State’s Attorney Wesley Adams said in court. He said that the beating occurred July 3, when the boy was home with Aniyah and his two biological sisters, ages 4 and 15.

The Washington Post generally does not name juveniles who are charged with crimes.

The boy — who initially faced a more-serious second-degree murder charge — did not admit guilt as part of his so-called Alford plea but acknowledged that prosecutors had sufficient evidence. Raouf Abdullah, the boy’s attorney, said his client agreed to the plea to spare his own family and Batchelor’s family an emotional trial, although he still disputed some of prosecutors’ accusations.

“This ends this trauma for the entire family,” Abdullah said.

Aniyah was placed with the boy’s family in November after she was removed from her home because of “allegations of physical abuse” related to one of her brothers, authorities have said.

Police had previously said that the boy’s father found Aniyah unconscious and called 911. The father had been called home by his 15-year-old daughter, who was watching the other children, they said.

During Wednesday’s hearing in Prince George’s County, the boy, who stood barely taller than his attorney’s shoulders, wore a red sweatshirt and athletic shorts.

When Judge Sherrie L. Krauser listed the charges against him and asked if he knew what they meant, the boy responded, “Yes. Well, not really.” When the judge asked him to explain what his plea meant, he was unable to do so.

Prosecutors had said previously the boy did not like Aniyah and did not want her in the home.

After Wednesday’s hearing, Abdullah disputed those accusations, saying the boy admitted to hitting Aniyah under “duress” and that he never told a detective that he didn’t want her in the home.

He said that the boy — who was involved in soccer, basketball and the science fair, his parents said at an earlier hearing — was “a delightful child” and that the case “essentially amounts to like an accidental death.”

Technically, the boy was found “involved,” the juvenile court term for a conviction. He will be held at the Cheltenham Youth Facility until a disposition hearing Oct. 23.

Although he could face incarceration until he is 21, he will first be evaluated by doctors to determine a rehabilitation and treatment plan, Abdullah said.

As deputies led the boy out of the courtroom in handcuffs, he cried and tried to lift his arms to wipe tears from his face. After the hearing, the families of the boy and Aniyah declined to comment.