Sunday was a historic day in Mexico, with a landslide election victory for Claudia Sheinbaum, the first woman and first Jewish person to become the country’s president.

But as much as it was about Ms. Sheinbaum, a decorated climate scientist and the mayor of Mexico City from 2018 to 2023, it was also about the most powerful man in the country who will soon head toward the exit.

The electoral triumph of President Andrés Manuel López Obrador’s handpicked successor marks the beginning of the end of a defining figure in Mexico.

He emerged from an area of the country where few national politicians have hailed and became president on his third try. He completely reshaped Mexican politics and built an entire political party around his outsize personality.

Critics also say he granted the military too much power and pushed measures that would chip away at democratic institutions, like the Supreme Court.

Yet, as the end of his six-year tenure approaches, Mr. López Obrador remains widely popular.