QUANTICO, Va. — Marine Col. Shane Tomko, an officer who had been accused earlier this year of inappropriate sexual contact, pleaded guilty Friday to a series of lesser charges, including conduct unbecoming of an officer and a gentleman, during his court-martial trial.

Tomko, 53, was sentenced to two months of jail time and a $20,000 fine. He will only have to pay half of it, however, because of a prior plea agreement. Tomko was relieved of his command of the Marine Corps’ Wounded Warrior Regiment in February 2015 after allegations of misconduct surfaced.

Tomko pleaded guilty to having inappropriate contact over text messages and Facebook with enlisted subordinates, including a Marine corporal he had also been charged with sexually harassing. The sexual harassment charges were dropped as a part of the prior plea deal.

The majority of the charges stemmed from when Tomko was stationed with the Wounded Warrior Regiment. During the court-martial, Tomko said his role as the commander regiment meant he had to have extremely close ties with those who reported to him.

Tomko also pleaded guilty to possessing anabolic steroids and unprescribed testosterone as well as to violating a recently served military protective order last month. A military protective order is much like a civilian restraining order.

According to the order, he was not permitted to contact his wife, Marine Lt. Col. Liza Tomko, or consume alcohol after being discharged from an inpatient mental health program at Fort Belvoir, Va. Tomko appeared intoxicated at a May 6 arraignment hearing and was charged with driving under the influence in addition to the violation of the protective order. He pleaded guilty to both charges Friday. Following his botched arraignment hearing, Tomko was sent to confinement for 21 days until Friday’s court martial. The 21 days will be counted as a part of his 60 day sentence.

With 33 years in the Marine Corps, Tomko’s career took him from the command of an infantry company during the opening days of the war in Afghanistan to a Missouri-based casualty assistance officer where he was the one often responsible informing families they had lost their loved ones.

Tomko’s defense attorney, Marine Maj. Geoff Shows, called a series of general officers to testify on Tomko’s behalf, as well as two doctors that had diagnosed the colonel with Post Traumatic Stress Disorder.

Marines who had served with Tomko used words and phrases such as “gunfighter” and a “Marine’s Marine” to describe their friend and colleague on trial. Many of them agreed however, that Tomko had declined both physically and mentally in recent months following the loss of his command, a fact that Shows played up, indicating that Tomko’s depression and traumatic stress contributed to his misconduct.

Tomko was first diagnosed with Post Traumatic Stress in the months after he was relieved from the Wounded Warrior Regiment, though he said he had been suffering from it for years.

“I’ve been clenching my fists my entire life,” Tomko said toward the end of his trial, visibly shaken and at times crying. “I can’t tell you the number of times in my life I’ve been told I needed to get help, but how could I?”

“The only thing I knew how to do was work hard.”

Col. Peter Houtz, the lead prosecutor, claimed that Post Traumatic Stress Disorder was no excuse for Tomko’s misconduct and that his repeated violations of the code of military justice stemmed from an attempting to control the outcome of his case, and by doing so only made his spiral downward more severe.

“We did everything we could to address it, and it didn’t work,” Houtz said of Tomko’s repeated stints at clinics and hospitals to help his declining mental health.

As a part of his plea arrangement, Tomko will seek retirement, however his attorney was not satisfied with the outcome of the trial.

“The Marine Corps got this one wrong,” Shows said to a group of reporters following the sentencing. He did not know, however, if Tomko would appeal the punishment.

This post has been updated.