Receive the latest new-england updates in your inbox

A former Massachusetts middle school worker accused of raping a 15-year-old boy pleaded guilty to four counts of rape of a child on Wednesday.

Janelle Foley of Weymouth will serve 2-1/2 to 4-1/2 years in prison, with probation, according to the Norfolk District Attorney's Office. Jury selection in her trial had been scheduled to begin on Wednesday, but she pleaded guilty on short notice.

She requested a stay of sentence through February vacation, but Judge Thomas Connors denied that request and she was transferred to the Massachusetts Correctional Institution in Framingham.

The victim was reportedly the son of a friend. Prosecutors said Foley had sexual relations with the teen at family Thanksgiving and New Year's parties at the victim's home in 2013.

Foley, a mother of four, was indicted in 2014 on four counts of rape and abuse of a child, according to The Patriot Ledger. She initially pleaded not guilty and had been free on $5,000 bail, with the condition that she have no contact with the victim or any children under the age of 18 other than her own children.

At the time of her arrest, Foley was working as a cafeteria worker at the Chapman Middle School in Weymouth.