Gen. Jonathan Vance, who led the military through a major pivot after the war in Afghanistan, announced Wednesday he is stepping down as chief of the defence staff.
The country's top soldier said his retirement will be official "in the months to come" after the government has found a successor.
The surprise announcement was made in a letter posted to social media, in which Vance told the members of the Armed Forces that they remain an inspiration to him and says he has given them his all.
"Until I relinquish command I will continue to serve you and Canadians with the same energy and effort I always have," he wrote.
Vance, 56, is among the longest-serving chiefs of defence staff in Canadian history.
There had been persistent reports the Liberals were going to recommend him to become NATO's top military official in the fall.
Defence sources, not authorized to speak publicly, told The Canadian Press the government informed Vance recently that wouldn't be the case.
He was first appointed to the job by the previous Conservative government in July 2015.
Over the next five years, he oversaw the Forces as it struggled to find a new focus after years of combat in Afghanistan sapped its mental and physical strength.
His first act as chief of the defence staff was to launch Operation Honour, the military's effort to stamp out sexual misconduct and one of many steps taken in an effort to modernize the Forces' demographics.
Vance's tenure also saw more involvement for the military in domestic affairs, including an increased role assisting in floods and wildfires, and most recently as support to long-term care homes dealing with COVID-19.
Under his watch, Canadians also took command of a NATO battle group in Latvia and a NATO training mission in Iraq, as well as making a year-long contribution to UN peacekeeping efforts in Mali.
"With almost 40 years of service, Gen. Vance has devoted his life to this country and we thank him for his dedication and leadership," Prime Minister Justin Trudeau said in a statement.
Trudeau said he has initiated the search for Vance's successor.
There has been ongoing turmoil in the top ranks of the military for close to three years.
In March, Lt.-Gen. Jean-Marc Lanthier announced his surprise retirement after less than a year as vice-chief of the defence staff.
He was the sixth vice-chief under Vance, and had been seen as someone who could replace him.
Lanthier had replaced former lieutenant-general Paul Wynnyk, who resigned abruptly following a dispute with Vance.
Wynnyk had been one of the top officers tapped to fill the post while the Mark Norman affair played out.
Vance suspended vice-admiral Mark Norman in January 2017 due to an RCMP investigation into whether Norman had leaked cabinet secrets about a shipbuilding project.
The vice-admiral was charged, but the charges were later dropped. Vance tried to reinstate Norman, but the admiral retired instead.
Vance had been heavily criticized for how he handled the case, with the suggestion at the time he was acting under political pressure to suspend Norman. He denied that allegation.
The scandal around Norman was one of several blemishes on Vance's reputation.
Last year, he issued a lengthy apology to families of soldiers killed in Afghanistan after making the decision to exclude them from a rededication ceremony for the Kandahar war memorial.
The military had given them no notice of the ceremony, nor were they invited to attend.
A new, public, ceremony was subsequently arranged.