Canada’s top civil servant – a central figure in the political crisis that continues to damage the prime minister, Justin Trudeau – has resigned from his post, following allegations of political bias from parliamentarians.

In a letter to the prime minister, Michael Wernick announced his plans to retire as clerk of the privy council, the most powerful non-elected position in the federal government. Wernick had previously held numerous senior government positions and had served under multiple prime ministers over nearly four decades.

“Recent events have led me to conclude that I cannot serve as clerk of the privy council and secretary to cabinet during the upcoming election campaign,” he wrote in the letter, referring to the political scandal that has already cost the Trudeau government two cabinet ministers and adviser.

Trudeau is battling allegations that he and his aides – including Wernick – improperly pressured the country’s attorney general to abandon the prosecution of SNC Lavalin, a large Montreal-based engineering company. SNC Lavalin is believed to have bribed the Libyan government for lucrative construction projects between 2001-2011 and is facing criminal charges.

In recent weeks, Wernick, who has twice publicly testified to the parliamentary justice committee, has been dogged by allegations from members of the Conservative and New Democratic parties that he acted in a partisan manner, following denials that he pressured former attorney general Jody Wilson-Raybould in the SNC Lavalin case. New Democrat Charlie Angus had previously called Wernick “deeply compromised” and demanded his resignation.

“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,” wrote Wernick in his letter.

Trudeau has named Ian Shugart has Wernick’s replacement.

Trudeau also used Monday to fill a new vacancy in his cabinet, prompted by the surprise resignation of treasury board president Jane Philpott, who exited after publicly castigating the Liberal government for its handling of the SNC Lavalin scandal. Trudeau appointed Joyce Murray as the new head of the country’s treasury board.