A woman whose death was ruled a suicide may have been killed by a former Massachusetts police detective, a grand jury indictment alleges.

Matthew Farwell, a former Stoughton, Massachusetts, police detective, is accused of killing then 23-year-old Sandra Birchmore in 2021 after she told him she was pregnant with his child.

Mr Farwell, 38, is accused of strangling her to death inside her apartment and then staging the scene to make it look like she took her own life.

He has pleaded not guilty, according to prosecutors.

The indictment alleges he killed Ms Birchmore to stop authorities from discovering details of his sexual offences.

Ms Birchmore participated in a programme for young people interested in law enforcement careers where Mr Farwell was a volunteer.

The indictment alleges he used his authority in that programme to groom, sexually exploit and later sexually abuse Ms Birchmore beginning when she was 15.

When she became an adult, he continued to have sex with her, according to the indictment.

“During some of the shifts when Farwell was supposed to be performing his duties as a Stoughton police officer, he was instead engaged in sex acts with Birchmore,” it alleges.

Ms Birchmore found out she was pregnant and told Mr Farwell he was the father in late 2020.

Around 20 January 2021, Ms Birchmore’s friend called the Stoughton Police Department, where Mr Farwell worked, and told them the pair were having sex.

The indictment alleges a police department employee told Mr Farwell about the call.

Ms Birchmore was found dead in early February 2021.

“When it became clear that Mr Farwell, that he could no longer control Sandra Birchmore, he allegedly silenced her permanently,” Joshua Levy, acting US Attorney for Massachusetts said at a press conference earlier this week.

“He allegedly attempted to cover his tracks to literally try and get away with murder. And he almost did, until today.”

Officials say critical new evidence led to the indictment. Mr Farwell was arrested on Wednesday.

He was an officer in the Massachusetts police department from 2012 to 2022.

He resigned that year along with two other police officers accused in an internal investigation of having an inappropriate relationship with Ms Birchmore.

The Stoughton Police Department worked with other agencies including the FBI to investigate the case, the department’s chief Donna McNamara said.

Ms McNamara said in a statement that she ordered a “lengthy and aggressive internal affairs investigation” to be conducted after Ms Birchmore’s death, which she called a “horrific injustice”.

If Mr Farwell is found guilty on the charge of killing a witness or victim, he faces a mandatory sentence of life in prison.

The death penalty is a possibility in this case but Mr Levy declined to say whether federal officials would seek that punishment.

Mr Farwell is being held without bail after pleading not guilty earlier this week.

He will next appear in court on 10 September.