Michael Wernick retires as Canada's top civil servant today, weeks after being thrust into the centre of a political firestorm over the SNC-Lavalin affair.

In a farewell statement, the retiring clerk of the Privy Council expressed gratitude to current and former colleagues over a career spanning nearly 38 years.

"I have loved to tell your stories — to remind Canadians how their world-class public service supports the governments they elect and works to enhance our security, prosperity and inclusiveness," he wrote.

"What we do matters — a lot. A non-partisan public service, guided by values, fuelled by evidence and science, and driven by a never-ending quest to learn, adapt and renew is essential to the success of this amazing country."

Wernick gave notice of his resignation March 18, noting there was no path for him to have a "relationship of mutual trust and respect" with opposition party leaders. He said recent events led him to conclude he could not serve as clerk of the Privy Council and secretary to cabinet during the upcoming election campaign.

Opposition Conservatives had accused Wernick of delivering a partisan defence of the Liberal government when he testified before the Commons justice committee probing the SNC-Lavalin matter.

Former justice minister Jody Wilson-Raybould testified she endured sustained pressure and veiled threats from various PMO and government officials, including Wernick, to intervene in the public prosecutor's decision to proceed with criminal corruption charges against the Montreal-based engineering and construction company.

During his testimony, Wernick insisted Prime Minister Justin Trudeau and others did not act inappropriately.

"At every opportunity, verbally and in writing in December, the prime minister made it clear that this was the decision for the minister of justice to take. She was the decision-maker," he said.

Conservative MP Michelle Rempel was among those who accused Wernick of failing to remain neutral.

"To any public servant watching Wernick — do not use him as your model on how to be a non-partisan professional," she tweeted.

On March 29, Wilson-Raybould released a recording of a 17-minute call with Wernick, during which he told her Trudeau was "quite determined" to prevent SNC-Lavalin's criminal trial from leading to job losses.

'Rising anxiety'

Wernick — who was not aware he was being recorded in the Dec. 19 call — told the minister there was "rising anxiety" over the fate of a major employer.

"He's quite determined, quite firm," Wernick said of the prime minister's position on getting a deferred prosecution agreement (DPA) for SNC-Lavalin. "But he wants to know why the DPA route, which Parliament provided for, isn't being used. And I think he's going to find a way to get it done, one way or another."

Wernick never mentioned the SNC-Lavalin matter in his goodbye statement, but said he is grateful for a career that allowed him to travel the country and work closely with ministers and prime ministers.

"I have great confidence that the public service is in good hands and that you will rise to the many challenges and even greater opportunities of the months and years ahead," he wrote.

"Stand up for your values and look after each other. The world needs more Canada, and Canada needs you. I wish you well."

Ian Shugart, a longtime civil servant, is Canada's new Privy Council clerk.