“To have reached that level of mathematics, it certainly implies that you are in love with mathematics,” said Michel Broué, a mathematician at the University of Paris. “And if you love it, it’s terrible to leave it.”

“Cédric always loves a challenge,” said Sylvia Serfaty, at New York University’s Courant Institute, and who studied with Dr. Villani at Paris’s École Normale Supérieure in the 1990s. “The Fields Medal was a challenge for him. He did it, he got it. So once that was done, I think he was also just needing a new challenge.”

He entered European politics about a decade ago, and moving in those circles, he met Mr. Macron, with whom he shared a “neither left nor right” mantra. Nonetheless, when courted to run for Macron’s party, Dr. Villani declined, twice. He was director of the Henri Poincaré Institute and had big plans in the works. Then, a few weeks before the presidential election in 2017, came the “fake news,” as he called it, proclaiming that he was indeed a candidate. “I saw that the idea was popular,” Dr. Villani said — so he reconsidered.

He asked the advice of Jean-Pierre Bourguignon, a former director of Institut des Hautes Études Scientifiques and the outgoing president of the European Research Council. Dr. Bourguignon told him it was a bad idea. “I feared that his weight as a scientist would be jeopardized by becoming a political statesman,” he said. “I was concerned that he would diminish his impact, rather than increase it.”

Dr. Villani is still wrapping his head around the transition. Sitting on the sofa, peering at his smartphone, he noted that the title of his latest book — “Immersion: From Science to Parliament” — has multiple meanings. “Immersion” describes his deep dive into politics (he considered titling it “Plunge”). And “with a little mischief,” he wrote in the introduction, immersion also refers to a mathematical operation “by which one ‘transports’ a geometric object, without changing its intrinsic nature, into the heart of a new ambient geometry.”

A combinatorial puzzle