TORONTO — Canadian Prime Minister Justin Trudeau violated conflict-of-interest and ethics laws when he tried to pressure the country’s former attorney general to cut a deal with a construction firm from his home province that would see it avoid criminal prosecution, an ethics watchdog ruled Wednesday.

In a 63-page report, Ethics Commissioner Mario Dion detailed a series of “troubling” interventions by Trudeau and members of his office that he said contravened laws prohibiting public officeholders from using their positions to seek to influence the decision of another person to “improperly” further the interests of a third party.

Though the ruling carries no direct penalty for Trudeau, such as a fine, it comes about two months before a federal election in October in which opinion polls show Trudeau’s Liberals and the opposition Conservatives in a dead heat. And it marks a major political setback for the image-conscious Trudeau who, despite campaigning in 2015 on a promise to run a government beyond reproach, is now the first sitting prime minister found to have twice broken ethics laws.

Speaking to reporters at Niagara-on-the-Lake, Ontario, Trudeau said that he takes responsibility “for the mistakes that I made.” But, he added, he disputed Dion’s finding that any contact with the attorney general on the SNC-Lavalin file was improper.

“I recognize that this is a situation that shouldn’t have happened,” Trudeau said. “But my desire to protect Canadians and at the same time, to protect the integrity and the independence of our judicial institutions, remained throughout.”

The ethics investigation was ordered in February in the wake of allegations that Trudeau and other senior government officials had tried to pressure Jody Wilson-Raybould, then the country’s attorney general, to negotiate an out-of-court settlement with SNC-Lavalin, a Montreal-based engineering and construction giant.

Canadian authorities charged the firm in 2015 for allegedly using bribes to secure business deals in Libya. The company sought a deal known as a deferred prosecution agreement, which would allow it to avoid a criminal conviction in return for admitting wrongdoing, implementing strict compliance rules and paying a fine.

Federal prosecutors denied the firm’s request, and Wilson-Raybould, the country’s first indigenous attorney general, supported their decision.

Dion found that Trudeau and other officials made a series of “flagrant” attempts to influence Wilson-Raybould to change her mind and “directed his staff to find a solution that would safeguard SNC-Lavalin’s business interests in Canada.” Trudeau has said that he was concerned a criminal conviction could lead to job losses.

“As Prime Minister, Mr. Trudeau was the only public office holder who, by virtue of his position, could clearly exert influence over Ms. Wilson-Raybould,” Dion said. “The authority of the prime minister and his office was used to circumvent, undermine and ultimately discredit the decision of [federal prosecutors] as well as the authority of Ms. Wilson-Raybould as the Crown’s chief law officer.”

He found that “partisan political interests” were improperly put to the attorney general, which was “contrary to the constitutional principles of prosecutorial independence and the rule of law.”

Wilson-Raybould was moved to another cabinet post in January — a move widely seen as a demotion — and resigned from the cabinet in February after the allegations emerged. Trudeau booted her from the Liberal caucus in April, and she will be running as an independent in the fall election.

Wilson-Raybould said in a statement that while the ethics commissioner’s findings represented “a vindication,” she also felt “sadness.”

“In a country as great as Canada, essential values and principles that are the foundation for our freedoms and system of government should be actively upheld by all, especially those in positions of public trust,” she said.

The SNC-Lavalin scandal cost Trudeau two high-ranking female cabinet officials and saw the resignation of his top aide. His treatment of Wilson-Raybould, who accused him and members of his office of making “veiled threats,” tarnished his reputation as a feminist prime minister who promised to restore Canada’s relationship with its indigenous people. His party has only just started recovering in the polls after hemorrhaging support in the wake of the scandal.

“The timing isn’t great,” said Christopher Sands, the director of the Center for Canadian Studies at Johns Hopkins University. “Having the reminder is an unwelcome thing. It will give the opposition something with which to beat the prime minister during the campaign.”

In a news conference, federal Conservative leader Andrew Scheer said the report painted “a clear picture of who Justin Trudeau truly is, and it’s not who he promised he would be.”

“He promised he would be accountable and ethical,” Scheer said. “Instead, time and time again, he has used the power of his office to enrich himself, reward his friends and punish his critics.”

This is the second time the ethics watchdog has taken aim at Trudeau. In 2017, the ethics commissioner found that Trudeau broke ethics laws when he accepted an invitation to a Bahamian island owned by the Aga Khan, the wealthy spiritual leader of Shiite Ismaili Muslims.