A high-ranking US Army general has been demoted and forced to retire after being exposed for exchanging flirtatious text messages with a subordinate’s wife, according to a new report.

Major General Joseph Harrington, who once led the US Army Africa, is set to be stripped of an star and retire as a one-star general, the last rank that he served satisfactorily, according to USA Today.

The demotion came at the end of an Inspector General probe into over 1,000 text messages that Harrington and the woman exchanged over a period of several months.

Although the authorities said the texts were not criminal in nature, they deemed them “not good examples of virtue and honor.”

Harrington tried to contain the damage to his reputation as a senior commander by issuing a passive apology, claiming he was not the one who started the “friendship-based” relationship.

“I made a mistake by responding to and entering into a private discussion with a soldier’s spouse,” Harrington wrote. “While we both considered it a friendship-based conversation, it is clear that the discussion should not have occurred. I hope others can learn from and avoid my mistake.”

The ruling drew criticism from activist groups, who said the IG was wrong in denying the criminal nature of the texts.

“It clearly was at minimum a violation of Article 133 of the UCMJ. And it may be news to the IG, but violations of the UCMJ are crimes,” said Don Christensen, president of the advocacy group for military sexual assault and harassment victims, Protect Our Defenders.

He was referring to an article of the United States Uniform Code of Military Justice, which states “any conduct unbecoming an officer and a gentleman” by military service members needs to be addressed in a court-martial.

The Italy-based woman who was involved in the relationship said Harrington’s texts were friendly at first but were followed by teasing and oblique sexual references.

The news comes amid official warnings by the Pentagon about growing sexual abuse within US military ranks.

Sexual assault in the US military has long been a massive problem, with service members reporting more than 20,000 allegations of sexual assault at military installations over the past four years.