SOMERVILLE - A former Sussex County sheriff's officer who admitted to engaging in a sexual relationship with a woman in drug court must serve 270 days in Somerset County Jail and spend three years on probation after being sentenced Monday in Somerset County Superior Court.

William R. Lunger, Jr., 36, of Hamburg also tipped the woman, identified by the initials C.T. in court, off to surprise weekend drug screenings and stole testing kits for her to use.

Under a plea deal, Lunger, who was facing a possible second-degree official misconduct charge, which carries a mandatory five-year prison term without probation, plead guilty in January to third-degree conspiracy to commit official misconduct.

It was revealed in court Monday for the first time that Lunger, who served in the U.S. Army, has been diagnosed with Post Traumatic Stress Disorder as the result of a 13-month stint in Iraq, and that it contributed to his actions, both Sussex County First Assistant Prosecutor Greg Mueller and defense attorney Jeff Ziegelheim told the judge.

Lunger, who served eight years in the army, is currently on full disability. He received an honorable discharge.

In addition to probation, Lunger, who received an Army Commendation Medal with Valor for his actions in Iraq, must continue to undergo psychiatric treatment for his, forfeit any future public service in the state and refrain from drinking alcohol.

Lunger, who must surrender on March 20, apologized to his family, the court and Sussex County law enforcement in a brief but emotional statement.

Superior Court Judge Robert B. Reed, who had the discretion to sentence Lunger to up to three years under the plea agreement, said he factored in Lunger's diagnosis in his sentencing. Lunger had no prior indictable offenses.

The case was transferred to Somerset County to avoid a conflict of interest.

"I think it was an appropriate sentence," said Mueller. "The judge gave it a great deal of thought. As he mentioned it's a truly unique case. The sentence contained both a punitive and rehabilitation component.

"Mr. Lunger has shown remorse. He apologized to me in chambers. He has sincere regrets about the embarrassment he has brought on law enforcement in Sussex County."

Ziegelheim made a passionate plea to the judge not to give his client any jail time.

Lunger was initially charged with four counts of official misconduct, one count of engaging in a pattern of misconduct, one count of conspiring to defraud a drug test and one count of theft.

Prosecutors have said that after the woman was tipped off about the surprise weekend drug tests, she would inform others in the program to the tests, commonly known as a "blitz."

During a March 20 "blitz," a large number of urine samples were diluted indicating that drug court participants may have had advance knowledge of the surprise screening, prosecutors have said.

Officials first received information about Lunger's alleged criminal activity on March 31, prosecutors have said.

Lunger, who was hired by the sheriff's office in 2007, was assigned to the Transport and Courts Division of the Sheriff's Office and provided courtroom security as part of his job.

The woman had been placed in the drug court program in 2015 following a conviction in Morris County, but was later transferred over to Sussex County. Before she was sentenced to drug court probation, the woman was placed on regular probation for a 2014 burglary conviction in Sussex County.

Dave Hutchinson may be reached at dhutchinson@njadvancemedia.com. Follow him on Twitter @DHutch_SL. Find NJ.com on Facebook.