Washington (CNN) A four-star US Navy admiral who was set to become the branch's top uniformed officer is instead retiring after his judgment was questioned over a professional relationship he maintained with a former Navy public affairs official who left the service amid allegations of sexual harassment and sexual assault.

Adm. William Moran was vetted for promotion after being nominated by President Donald Trump and confirmed by the Senate in May but that plan abruptly changed Sunday when he announced his retirement.

He was expected to take over the job in August.

Adm. John Richardson, the current Chief of Naval Operations will remain in the post until a replacement can be identified, according to a statement by Secretary of the Navy Richard Spencer. Richardson can remain in the job until September.

Richardson addressed the situation in an email to Navy staff and flag officers on Monday.

"It is my sad duty to confirm to you that Adm. Moran has submitted his request to retire. The Secretary of the Navy has accepted his request. He will not serve as the next CNO," Richardson wrote, according to a copy of the email obtained by CNN.

"This is an extremely difficult situation, but importantly, this matter strongly reinforces the importance of trust, and the high standards of behavior needed to secure that trust. The American people expect this from us. We must expect and enforce this standard for ourselves," he wrote.

Pentagon vacancies

Moran's departure comes at a time when the Pentagon continues to operate without a Senate-confirmed secretary of defense. Many other senior military roles remain unfilled or are filled by officials in acting roles

Those vacancies are a reflection of the Department of Defense's ongoing struggle to establish an unprecedented transition plan aimed at ensuring continuity of leadership at the highest levels while there is still no confirmed secretary of defense following the dramatic implosion of Patrick Shanahan's nomination last month.

According to Spencer, Moran retired from the service rather than take on the role of chief of naval operations due to a situation where 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."

"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," Spencer wrote.

Moran said in a separate statement he "made this difficult decision based on an open investigation into the nature of some of my personal email correspondence over the past couple of years and for continuing to maintain a professional relationship with a former staff officer, now retired, who had while in uniform been investigated and held accountable over allegations of inappropriate behavior."

"To be clear, my decision to maintain this relationship was in no way an endorsement or tacit approval of this kind of conduct," he added.

"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," Moran said.

Both statements from Moran and Spencer note the situation arose from a professional relationship over the course of Moran's career with the Navy, rather than a private relationship.

Professional relationship under scrutiny

While Spencer did not provide any details about the unnamed individual, three officials told CNN that Moran's resignation stems in part from continued contact with Chris Servello, a former Navy public affairs adviser to Adm. Richardson, who was removed from his post in 2017.

Servello retired honorably from the Navy last May after being reprimanded for his conduct at a Christmas party in December 2016 where he was accused of making unwanted sexual advances on a junior officer while dressed as Santa Claus.

No charges were filed but the Pentagon Inspector General did launch a wider investigation looking into the handling of that incident by Adm. Richardson, according to multiple Navy officials.

"We initiated an investigation that assessed Navy Admiral John M. Richardson's response to sexual harassment and sexual assault allegations against a member of his personal staff," the report says.

Multiple Navy officials told CNN that Moran's decision was prompted by revelations that he maintained a professional relationship with Servello after the investigation into his behavior.

"I'm aware of Admiral Moran's decision and it's hard not to feel disappointment and disbelief. This is terrible news for the Navy. Beyond that I have nothing else to add," Servello said in a statement to CNN.

In his email to Navy staff on Monday, Richardson did not name Servello but did note that Moran "maintained an off-the-record collaboration on high-level official Navy business with an officer who had previously been held accountable for inappropriate behavior towards junior female officers."

"Adm. Moran recognized that the nature of this collaboration made it untenable for him to serve as the CNO, which is why he requested to retire," Richardson added.

CNN has reached out to the Pentagon for additional comment.

Correction: This Story has been updated to reflect that William Moran is a four-star admiral.