Vice-Admiral Mark Norman is retiring from the Canadian Forces after reaching a "mutually acceptable agreement" with the government.
The surprise announcement comes more than a month after Crown prosecutors stayed their politically charged breach-of-trust case against the military's former second-in-command.
Norman said at the time that he wanted to return to duty, a plan that was welcomed by defence chief Gen. Jonathan Vance even as questions swirled over whether Norman would file a lawsuit against the government.
Instead, Norman and the government said in a joint statement the Department of National Defence released Wednesday that "after consulting with his family, his chain of command, and his counsel, Vice-Admiral Norman has decided to retire from the Canadian Armed Forces."
The statement also revealed that Norman's lawyers had negotiated a "mutually acceptable agreement" with the government, "the details of which will remain confidential."
The talks were overseen by former Ontario Court of Appeal chief justice Warren Winkler and took place during the last two weeks of June.
"Both parties believe that this resolution will return focus to the critical work of the Canadian Forces, which is the protection of all Canadians," the statement said.
"The government of Canada thanks Vice-Admiral Norman for his 38 years of dedicated service and wishes him well in all of his future endeavours."
Norman's lawyers declined to comment on Wednesday.
A date has not been set for his retirement.
Norman was suspended from the military in January 2017 and later charged with breach of trust for allegedly leaking government secrets to put pressure on the government to approve a $700-million shipbuilding project.
The former navy commander, who was vice-chief of the defence staff when he was suspended, denied any wrongdoing and his lawyers accused the federal Liberal government of political interference in the case.
While the Liberals in turn denied that charge, Norman's case nonetheless became a cause celebre for the federal Conservatives and many former military personnel rallied to his defence.
Following months of pre-trial hearings in which Norman's lawyers fought for access to thousands of pages of secret government documents, including some from Prime Minister Justin Trudeau, the Crown stayed the case on May 8.
Prosecutors said at the time that new information uncovered by Norman's legal team had left no reasonable prospect of a conviction.
While Norman told reporters shortly after that he had "an important story to tell that Canadians will want and need to hear," one of the questions now is whether his agreement with the government precludes him from talking.
If so, that could be welcome news for the Liberals as Norman's case has haunted them for the past two years — and will likely figure in some way during the federal election campaign this fall.