WASHINGTON — Adm. William F. Moran, who was nominated to be the Navy’s next chief, abruptly announced his retirement in a statement on Sunday, citing an ongoing ethics investigation into his relationship with a subordinate who was “held accountable over allegations of inappropriate behavior.”

Admiral Moran’s decision to decline his appointment to be chief of naval operations and instead retire has sent the Navy scrambling to find a new candidate as the Pentagon operates with officials in acting roles in top jobs and without a confirmed secretary of defense.

Though Admiral Moran did not mention him by name in the statement, two Defense Department officials identified the unnamed subordinate as Cmdr. Chris Servello, a former Navy public affairs officer who was accused of harassing female colleagues at a Christmas party in 2016. The incident was first reported by USA Today in 2017.

Both department officials spoke on the condition of anonymity. Additionally, one said that a Freedom of Information Act request for email exchanges revealed the depth of Admiral Moran’s relationship with Commander Servello over the last two weeks.