NORTHAMPTON — A Belchertown woman pleaded guilty Friday to being an accessory in her infant’s beating by her then-boyfriend and lying to police about his whereabouts.

But Judge Richard Carey rejected a plea deal reached by defense attorney John Drake, of Northampton, and Assistant Northwestern District Attorney Caleb Weiner.

Melonie Cummings, 28, of Belchertown, was charged with permitting an injury to a child, accessory after the fact and misleading the police. The charges together carried a state prison sentence of up to 17 years. The deal would have sentenced Cummings to two years in state prison.

Cummings’ infant daughter was admitted to the hospital in November 2014 with broken ribs and bruises across her face and ears, Weiner said in court.

Carey said he rejected the plea on the grounds that the deal did not include a guarantee that Cummings would testify against her ex-boyfriend if his case goes to trial. The attorneys and Cummings agreed to explore options related to her possible testimony against him, and Carey continued the case to an unspecified date.

Cummings told first responders that the child sustained injuries after falling on a toy. But the injuries were totally inconsistent with a fall, doctors who treated the child said, according to Weiner.

Investigators determined that Keith A. Truehart, Cummings’ then-boyfriend, had been alone with the baby, Weiner said. Cummings had returned home after a methadone treatment when she found her injured baby daughter, Weiner added.

Police initially could not find Truehart when they looked for him at Cummings’ apartment.

Cummings admitted in court Friday to helping Truehart avoid police by creating a makeshift hideout for him under her kitchen sink. Truehart, who was arrested in June 2015, remains jailed while he awaits trial on two counts of assault and battery on a child causing substantial injury and one count of witness intimidation.

Note: This story has been revised to clarify the number of years Cummings could have faced in prison.

Michael Majchrowicz can be reached at mmajchrowicz@gazettenet.com.