His government made a splash early on, unveiling one of the most gender-balanced cabinets in the world, legalizing recreational marijuana and welcoming more than 25,000 Syrian refugees.

He also successfully navigated a mercurial American president and clinched a sweeping trade deal with the United States. Under his watch, the Canadian economy is buoyant.

But his vow to bring a different “sunny” approach to politics was undercut earlier this year by his intervention in a criminal case involving a major Canadian engineering company.

Mr. Trudeau said he was trying to save jobs by pressing his attorney general and justice minister, Jody Wilson-Raybould, to ask for a civil penalty instead of pursuing the criminal prosecution. But Ms. Wilson-Raybould, who is Indigenous, accused Mr. Trudeau and his mostly male aides of improperly pressuring her, and said she felt bullied.

A federal ethics commissioner ruled that Mr. Trudeau broke a conflict of interest law.

Much of the public echoed its dismay: Here was a leader who promised a new, honest, open approach to governing, inserting politics into a criminal case.

That was troubling to many, and damaged his image, but that was not all.

Earlier in his tenure he had used 4.5 billion Canadian dollars in government money, or about $3.4 billion , to buy a pipeline connecting Alberta’s oil sands to the Pacific Coast. The purchase riled many environmentalists, who said he was more concerned about Canada’s energy industry than about the environment.

He also took his family on a state visit to India, where they all dressed in sumptuous local garb. It may have been intended as good-natured but instead appeared culturally insensitive and became an exercise in national cringing.