A man accused of repeatedly raping his girlfriend’s 12-year-old daughter and arranging sexual encounters between the child and others pleaded guilty Wednesday to lesser offenses.

A trial set to begin for Ivy Edward Martin, 40, was halted Wednesday when he pleaded guilty to one count each of sexual battery and molestation of a juvenile. Sentencing is set for Jan. 5.

Five other people have already pleaded guilty in the case.

Martin was indicted in March 2014 by a grand jury on seven counts of aggravated rape and one count of molestation of a juvenile.

Assistant District Attorney Sue Bernie, who handles sex crimes for the East Baton Rouge Parish District Attorney’s Office, said Wednesday that the plea was part of an agreement with her office and had been struck after consulting with the victim and her family. Bernie said the plea agreement will allow the victim to avoid having to testify in court.

“The sentence that will be imposed will be tantamount to a life sentence,” said Bernie, who said Martin suffers from a serious illness. Although Bernie declined to specify what medical condition Martin suffers from, Martin wrote in a letter to state District Judge Tony Marabella that he has “full-blown AIDS.”

AIDS is a disease that weakens the immune system, gradually destroying the body’s ability to fight infections and certain cancers.

“I take so many pills just to stay alive,” Martin wrote in the letter to the judge.

Elsewhere in the letter, Martin alleged that his codefendants had lied about him for a plea deal and asked for the judge to consider his side of the case.

“I ask that you really take time and you will see that what people try to make me out as is a monster. Sir, I’m not. I’m a father and I’m human,” Martin wrote.

A defense attorney for Martin declined to comment.

The investigation began in November 2013 after a relative told authorities she believed the girl was possibly pregnant and being forced to have sex with Martin, who was then the boyfriend of the girl’s mother. The charges alleged that the girl was raped between June 1, 2013, and Nov. 21, 2013, in East Baton Rouge Parish, according to court records.

Also charged with aggravated rape were Brandon Edwards, 28, and Jerome Jackson, 41, both of Port Allen; Michael Sherbin, 37, and Jessica Carr, 24, both of Baton Rouge; and Arthur Lee Jones, 57, of Baker.

All five pleaded guilty to the reduced charge of indecent behavior with a juvenile earlier this year. They were each given sentences ranging from 18 to 25 years. All but three to eight years of their sentences were suspended, and each was given five years probation.

Martin told investigators at the time of his arrest that he was “sick and needed help,” but has denied claims he raped the girl on a weekly basis beginning in September 2013, according to court records.

Authorities have said Martin warned the girl she would be “made a fool of and no one would believe her” if she reported the sexual assaults.

In December 2013, deputies issued a summons to the mother of the girl who told investigators the girl was raped numerous times in 2012.

Law enforcement officials did not release the name of the girl’s mother, who was issued a summons for contributing to the delinquency of a juvenile, Sheriff’s Office spokeswoman Casey Rayborn Hicks has said.

The woman, who was not indicted, told investigators she took her daughter to the hospital for treatment after the girl revealed Martin was having sex with her.