Justin Trudeau’s announcement that he would step down as Canada’s prime minister was expected after he faced political struggles in recent months, but it nonetheless represented a stunning fall for a leader once so beloved that his diplomatic meetings were marked by fans lining up to take selfies with him.

Here is a look at his political rise and fall, which has played out over the past 25 years.

2000: Mr. Trudeau was already a celebrity when he was born on Christmas Day in 1971, the son of Pierre Elliott Trudeau, the prime minister at the time, and his glamorous wife. Margaret. But the eulogy Mr. Trudeau delivered in 2000 for his father returned him to the spotlight and provided an early glimpse of his political aspirations. “We have gathered from coast to coast to coast. From one ocean to another, united in our grief to say goodbye,” Mr. Trudeau, then 28, told a packed cathedral of mourners. “But this is not the end.”

2008: Mr. Trudeau, a former high school teacher, was elected to Parliament at the age of 36.

2012: Mr. Trudeau won a charity boxing match against a Conservative who had a black belt in karate, lifting his political profile and popularity.

2013: Mr. Trudeau was elected to lead the embattled Liberal Party, which was the dominant federal political force for most of Canada’s history, especially during many of his father’s 15 years as prime minister. But it had suffered for a decade from a major ethics scandal in Quebec and from three consecutive party leaders who had distinguished résumés but left voters unimpressed.

2015: Mr. Trudeau burst onto the international scene as a newly elected young leader of Canada. He unveiled the country’s first gender-balanced cabinet and — when asked why balance mattered — quipped, “Because it’s 2015,” a response that helped advance the progressive brand he would build in the decade to come. He styled himself as a feminist, an environmentalist, and an advocate for refugee rights and Indigenous rights. Vogue ranked him as one of the year’s 10 “convention-defying hotties,” referring to him as a “Canadian politician-dreamboat.”

2016: Mr. Trudeau outlined a national carbon tax program that included rebates for consumers. The plan was one of his major accomplishments as prime minister, but was seized on by his political opponents as having put a burden on everyday Canadians.