The abuse that 4-year-old Myls Dobson suffered — the beatings, burnings and deprivation — lasted for three weeks and ended with his death in January 2014. The prison term his killer faces will be far longer than the life the little boy had.

The woman who was charged with beating the boy to death in a Manhattan apartment while he was in her care pleaded guilty on Thursday to murder, the Manhattan district attorney, Cyrus R. Vance Jr., announced.

The woman, Kryzie King, 29, also pleaded guilty to assault and attempted assault and faces a prison term of 22 years to life. Ms. King admitted that she had repeatedly beaten Myls over a three-week period until his death, binding his hands and feet and whipping him with electric cords and belt buckles, Mr. Vance said.

The plea, in State Supreme Court in Manhattan, came a week after Justice Robert Stolz offered the sentence, slightly less than the maximum of 25 years to life that the district attorney had proposed at previous court appearances. She is to be formally sentenced on Oct. 21.