A decorated admiral who was set to become the US Navy’s top officer has decided to turn down the position — and will retire instead — after an investigation found that he had maintained an inappropriate “professional relationship” with a former military official accused of sexual misconduct.

Adm. William Moran, a 1981 graduate of the Naval Academy in Annapolis, is slated to step down on Aug. 1, according to officials.

He reported his resignation to Navy Secretary Richard Spencer and declined his appointment as the next chief of naval operations in a statement Sunday.

“As painful as it is to submit my request to retire, I will not be an impediment whatsoever to the important service that you and your families continue to render the nation every day,” Moran said.

The four-star admiral was found to have maintained a relationship with his former public affairs officer, Chris Servello, after he was removed from his position in 2017.

Servello had been accused of sexual misconduct and was also issued a non-punitive letter of reprimand for drinking and fraternizing with junior officers. He allegedly made unwanted sexual passes at a 2016 Christmas party while dressed as Santa.

“To be clear, my decision to maintain this relationship was in no way an endorsement or tacit approval of [Servello’s behavior],” Moran explained. “I understand how toxic it can be to any team when inappropriate behavior goes unrecognized and unchecked. Every Sailor is entitled to serve in an environment free of harassment or intimidation.”

No charges were ever filed against Servello, who wound up retiring from the Navy last year at the rank of commander. Branch officials told the Associated Press that Spencer didn’t learn of Moran’s continued involvement with him until after the admiral’s Senate confirmation in May.

Moran reportedly admitted to keeping in touch with Servello after his departure. He wrote in his statement that his “difficult decision” to retire was “based on an open investigation into the nature of some of [his] personal email correspondence over the past couple of years.”

“Adm. Bill Moran recently brought to my attention that over the past two years he maintained a professional relationship with an individual who was held accountable and counseled for failing to meet the values and standards of the Naval profession,” Spencer said in a statement. “While I admire his faithful service and commitment to the Navy, this decision on his part to maintain that relationship has caused me to call his judgment into question. Therefore, today I accepted Adm. Moran’s request to retire.”

Servello told the Associated Press that he was disappointed by Moran’s decision to retire.

“This is terrible news for the Navy, and beyond that, I don’t have anything to add,” he said. “It’s hard not to feel disappointment and disbelief.”

The news of Moran’s retirement comes less than a month after acting Defense Secretary Pat Shanahan decided not to go forward with his confirmation process. The Pentagon is still operating without a Senate-confirmed secretary of defense.

Adm. John Richardson, current chief of naval operations, will keep the position until a replacement is selected for Moran.

With Post wires