WASHINGTON — The man set to take over as the head of the Navy declined the position over the weekend, less than one month before he was scheduled to begin the job.

In a statement, Adm. Bill Moran confirmed that he had declined the appointment to chief of naval operations, and regretted “any inconvenience” his decision caused President Donald Trump and Navy Secretary Richard Spencer. He said that though it was painful for him to retire instead, he did not wish to be an “impediment” to the Navy.

“I 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,” he said.

“To be clear, my decision to maintain this relationship was in no way an endorsement or tacit approval of this kind of conduct. 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.”

Spencer said he had accepted Moran's request to retire.

"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. 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."

A U.S. official familiar with Moran’s resignation said he resigned because of an association with retired Navy Cmdr. Chris Servello.

Servello worked for and with Moran several times over roughly a decade, with Moran serving as a mentor to him.

Servello was investigated by the Navy for his behavior at a 2016 holiday party at the Pentagon, where he was accused of making unwanted sexual advances at women, including junior officers, while dressed as Santa Claus.

No charges were filed against Servello, but he was counseled for bad judgment and excessive drinking. Servello, who was then working as the spokesperson for Chief of Naval Operations Adm. John Richardson, continued working in the Pentagon until he retired in spring 2019.

Moran maintained contact with Servello during and after the investigation, including communicating with him on his personal email account. The investigation into Moran's ongoing contacts with Servello was conducted by the Defense Department's Office of the Inspector General.

Moran served as the vice chief of naval operations (VCNO) until last month, when he was replaced by Adm. Bob Burke. Moran was scheduled to take over as chief of naval operations on Aug. 1, replacing Richardson, who is set to retire.

Richardson will now stay on until a new chief is nominated, according to the defense officials. By law, Richardson cannot serve in that role beyond Sept. 17, 2019, when he will have served four years in the position.

On Monday, Richardson sent an email to all Navy leaders, both civilian and military, saying that Moran's decision to retire was a "difficult situation," but Moran's conduct had reinforced the need for "high standards of behavior."

"Adm. Moran, as VCNO, had 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," wrote Richardson.

"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."