Prime Minister Justin Trudeau's top adviser has resigned while denying allegations he pressured Canada's former attorney general to avoid prosecuting a major Canadian engineering firm.

Principal Secretary Gerald Butts has been Trudeau's closet adviser and best friend since university. Butts issued a statement Monday denying that he or anybody else in Trudeau's office pressured Jody Wilson-Raybould.

He said he's leaving in order to defend himself without distracting from the prime minister's work.

The Globe and Mail newspaper reported this month that Trudeau or his staff pressured Wilson-Raybould to try to avoid a criminal prosecution of Montreal-based SNC-Lavalin over allegations of corruption involving government contracts in Libya.

Critics say that would be improper political meddling in a legal case.

Wilson-Raybould resigned from the cabinet last week but gave no reasons.