OTTAWA (Reuters) - The head of Canada’s federal bureaucracy said on Monday he was quitting over his role in handling a corporate corruption case, dealing another blow to Prime Minister Justin Trudeau as he battles the biggest political crisis of his tenure.

Canada's Prime Minister Justin Trudeau and Privy Council Clerk Michael Wernick attend a cabinet shuffle at Rideau Hall in Ottawa, Ontario, Canada, March 18, 2019. REUTERS/Chris Wattie

Polls suggest that Trudeau’s Liberals - who a few months ago looked certain to be re-elected in October - are now at risk of losing power to the official opposition Conservatives.

Trudeau has been on the defensive since Feb. 7 over allegations that top officials leaned on former Justice Minister Jody Wilson-Raybould to ensure engineering and construction firm SNC-Lavalin Group Inc avoided a corruption trial.

Top civil servant Michael Wernick told Trudeau he would be retiring in the coming weeks because opposition leaders had lost confidence in him over the scandal. Two high-profile women cabinet ministers and Trudeau’s closest personal aide had already quit over SNC-Lavalin before Monday’s resignation.

Wernick, the clerk of the privy council, is supposed to be non-partisan, like the rest of the federal bureaucracy. But his strong defense of government officials over the SNC-Lavalin affair and his insistence that no one had done anything wrong triggered widespread criticism from opposition legislators that he was siding with the Liberals.

“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,” said Wernick, who was appointed by Trudeau in early 2016.

Clerks have traditionally had an exceptionally close relationship with prime ministers, and the two tended to talk every day. Wernick’s departure leaves Trudeau needing to fill one of the top jobs in Ottawa just months ahead of the election.

Trudeau spokesman Matt Pascuzzo said the prime minister had not asked Wernick to go.

Wilson-Raybould told the House of Commons justice committee last month that Wernick had put intense pressure on her to help SNC-Lavalin avoid prosecution over allegations it bribed Libyan officials.

Slideshow ( 8 images )

The scandal is the most serious faced by the 47-year-old Trudeau since he led the Liberals out of the political wilderness and into power in 2015 on a promise to do politics differently.

The Conservatives, the largest opposition party in parliament, and the left-leaning New Democrats accuse Trudeau of old-style backroom deals and trying to cover up what happened.

Conservative leader Andrew Scheer said Wernick had resigned “in disgrace” and repeated his calls for a full public inquiry, an idea that Trudeau has already ruled out.

“This is like a five-alarm dumpster fire of political cronyism, incompetence and now obstruction. What is the prime minister so afraid of?” New Democrat legislator Charlie Angus said in the House of Commons.

Earlier this month, Trudeau denied he or his officials had interfered in the judicial system, and he offered no apology.

In a surprise move, Trudeau on Monday named Joyce Murray, a 64-year-old Liberal backbencher with no federal cabinet experience, as president of the Treasury Board, where she will be in overall charge of government spending.

Murray replaces Jane Philpott, who quit on March 4 in protest over how the government was handling the crisis.

Wilson-Raybould, who was demoted in January, resigned from Trudeau’s Cabinet the next month.

SNC-Lavalin is accused of bribing Libyan officials to get contracts between 2001 and 2011. The firm had strongly lobbied in favor of a deferred prosecution agreement, or out-of-court settlement, instead of going to trial.

The company has declined further comment.