Representatives for SNC-Lavalin hustled to connect with federal prosecutors after the Liberal government quietly introduced a proposal last year to allow corporations to strike settlement deals and avoid criminal prosecution, court documents show.

The company's lawyers acted so quickly to position their client for a so-called remediation agreement that they contacted prosecutors weeks before lawmakers, even Liberals, were even aware the Trudeau government had tucked the legislation into its 582-page omnibus budget bill.

The Montreal-based engineering and construction firm is at the centre of a controversy that has enveloped the Prime Minister's Office. Since last week, the government has seen the high-profile resignations of one cabinet member -- former justice minister and attorney general Jody Wilson-Raybould, who became the minister of veterans affairs in January -- and Prime Minister Justin Trudeau's principal secretary, Gerald Butts.

SNC-Lavalin worked hard to avoid criminal proceedings by proposing a remediation agreement, but in September the prosecutor's office declined to invite the company to negotiate. A guilty verdict on bribery and corruption charges has been characterized as an existential threat for SNC-Lavalin and its employees because the company would be barred from bidding on government contracts in Canada for 10 years. Much of its work is in designing, building and operating public infrastructure.

The company lobbied federal officials, including in the Prime Minister's Office, to put remediation agreements into the law in the first place. The tools, known as deferred prosecution agreements in other jurisdictions, had already been enacted in the United States and the United Kingdom.

The Globe and Mail newspaper has reported that Wilson-Raybould came under pressure from staff in the Prime Minister's Office to step in and help SNC-Lavalin avoid criminal prosecution related to contracts in Libya.

Early in 2018, SNC-Lavalin wasted little time making its case for a remediation agreement with prosecutors.

Court documents filed last month by the firm's lawyers say they contacted the Public Prosecution Service of Canada "in or about the month of April 2018, shortly after the Government of Canada introduced the proposed legislative changes to implement a remediation agreement regime."

This would have been weeks before many lawmakers -- including at least one Liberal -- tasked with studying the amendment were even aware of its existence.

Last May, members of the all-party parliamentary committee examining the large budget bill said they only learned about the remediation-regime proposal after it was brought to their attention during testimony of a Justice Department official. Those included Greg Fergus, the Liberal MP for Hull-Aylmer in Quebec, who said at the time that he hadn't noticed the provision when trying to grasp the document.

While the company's effort began months before the amendment came into force last September, the documents say federal prosecutors declined to "undertake formal steps towards a remediation agreement regarding this matter (or any other) prior to the enactment of the legislation."

"The purpose of this contact, and of the discussions which followed, was to ensure that the (Director of Public Prosecutions) possessed all relevant information the applicants could provide in relation to the eventual issuance of an invitation to negotiate a remediation agreement, once the enabling legislation was in force," SNC-Lavalin's legal team wrote in the court documents, which were obtained by The Canadian Press.

From there, over the next three months, the documents say federal prosecutors engaged with SNC-Lavalin's lawyers and requested they provide detailed information. The company's legal team argued in the documents that it believed SNC-Lavalin easily met the criteria to receive an invitation to negotiate a remediation agreement -- and it made "repeated submissions to this effect" to prosecutors.

A letter contained in the court filings shows that Trudeau met with Wilson-Raybould almost two weeks after federal prosecutors informed SNC-Lavalin it would not be invited to negotiate a settlement.

The letter shows the director of public prosecutions told SNC-Lavalin last Sept. 4 about its decision. Trudeau has said that he spoke with Wilson-Raybould about the SNC-Lavalin case 13 days later, on Sept. 17.

The Sept. 4 decision date adds new information to the timeline of events. Until now, it had appeared that Trudeau spoke with Wilson-Raybould before the prosecutor's decision not to proceed with the settlement negotiation. SNC-Lavalin publicly announced it had been refused a negotiation Oct. 10.

Wilson-Raybould resigned from cabinet last week and has sought legal advice from former Supreme Court justice Thomas Cromwell amid questions over the SNC-Lavalin controversy.