Canada's top civil servant is retiring after nearly 38 years because he says he can no longer have a "relationship of mutual trust and respect" with opposition party leaders.

In a separate announcement, the prime minister said in the House of Commons Monday he was picking former Liberal cabinet minister Anne McLellan as a "special advisor" to examine questions related to the SNC-Lavalin affair and report back to him by June 30.

Clerk of the Privy Council Michael Wernick said in a letter to Prime Minister Justin Trudeau on March 18 that he had concluded he could not serve during the upcoming election campaign.

Wernick's committee testimony on Feb. 21, where he disputed a news report about former attorney general Jody Wilson-Raybould being inappropriately pressured to intervene in the firm's criminal prosecution, led to opposition members labeling him as partisan.

Wilson-Raybould then testified that Wernick was intimately involved in the effort to pressure her. Wernick has denied he acted in a partisan manner.

"One of the key roles of the Privy Council Office is to be ready to assist whichever government Canadians elect in October," he wrote in his resignation letter to Trudeau.

"It is now apparent that there is no path for me to have a relationship of mutual trust and respect with the leaders of the Opposition parties."

It is also essential that the top civil servant be seen as an impartial arbiter, Wernick said, of whether foreign interference in the election has occurred.

The clerk sits on a newly-created government body, along with the federal national security and intelligence adviser and three deputy ministers, that is charged with alerting the public on foreign meddling in the election during the campaign period.

"The timing of my retirement is something we should discuss," Wernick continued in his letter to Trudeau. "I will have more to say later." He then thanked the prime minister for placing confidence in him over the government's term.

Attorney general, justice minister roles to be studied

Ian Shugart, currently the deputy minister of foreign affairs, will replace Wernick "in the coming weeks," Trudeau said in a statement. Hours before his announcement, Wernick had helped swear in Treasury Board President Joyce Murray at Rideau Hall.

McLellan, who held several cabinet roles including justice minister under former prime minister Jean Chrétien and deputy prime minister under former prime minister Paul Martin, will assess whether the roles of justice minister and attorney general should be separated. That was something that Wilson-Raybould had suggested the justice committee study.

"She will consider whether machinery of government or legislative changes may or may not be recommended," Trudeau's announcement stated. "She will also analyze the operating policies and practices across the cabinet, and the role of public servants and political staff in their interactions with the minister of justice and attorney general of Canada."

McLellan previously chaired the Trudeau government's Task Force on Cannabis Legalization and Regulation.

Opposition Conservatives laughed at Trudeau's announcement in the House of Commons, questioning whether the prime minister was proposing to ask a Liberal to investigate other Liberals. Conservative Leader Andrew Scheer later joked during the daily question period about whether Trudeau had selected McLellan for the role because former Liberal cabinet minister Sheila Copps was not available.

Copps has also been criticized in recent days for defending Trudeau and suggesting that Wilson-Raybould had mishandled the SNC-Lavalin file and should be ejected from the Liberal caucus for not being loyal to the prime minister.

Editor's note: This article was updated at 4:15 p.m. ET on March 18, 2019 with additional background information and reaction from Conservatives.

Keep reading