School textbooks and state television programs, even if they briefly mention his human rights abuses, celebrate Stalin as a great leader. Mr. Putin has backed a planned monument to the victims of Soviet political repressions in Moscow, but that’s likely pure politics. He wants to play to the masses who are growing enamored of Stalin without alienating those Russians, such as the Moscow intelligentsia, who abhor him. The president has also carefully praised Stalin: “We can criticize the commanders and Stalin all we like, but can anyone say with certainty that a different approach would have enabled us to win?” he once said about World War II.

But Stalin receives more than just cagey rhetorical support. On Feb. 22, the Russian Military History Society — which Mr. Putin founded in 2012, is headed by the minister of culture and receives millions of dollars in state funding each year — paid for a bust of Stalin to be installed at a war museum in the city of Pskov, near the Estonian border. The minister of culture recently supported an exhibition of Socialist Realist paintings by Aleksandr Gerasimov, one of Stalin’s court painters, featuring portraits of the “generalissimo.”

Why is Stalin now gaining popularity? For one, people remember less and less about his purges and prison camps — which in Russia began to be thoroughly investigated and openly discussed only in the 1980s. As the sharp edges of Stalin’s image have gone out of focus, he has become what Ilya Budraitskis, a leftist thinker and activist, described to me as an “empty shell that can be filled with different meanings.”

I saw this firsthand in Penza. The Communists at the Stalin Center longed for his command economy, arguing that the hyperinflation and collapses of the 1990s were far worse than Soviet-era shortages; a right-wing, neo-pagan taxi driver told me that his favorite historical figures are Stalin and Hitler because they were able to “keep order.”

In today’s Russia, corrupt officials steal from the budget, police officers demand bribes and judges are believed to be bought and sold. Longing for the “order” of the past is palpable. The problem is that the fans of order never picture themselves as the ones being repressed, said Sergei Oleynik, head of the Penza branch of the liberal Yabloko Party. “When they talk about the Stalin era, they imagine the holster at the side, but not the barrel to the back of their neck,” he told me.

The Kremlin also plays on Russian nostalgia for superpower status, stressing the glories of the Soviet past — first and foremost, victory in World War II — over the persecutions and famines. When Russia is besieged by enemies, including a government in Ukraine that the state news media has described as a “fascist junta,” the image of Stalin the defender against Nazis wins out over that of Stalin the paranoid tyrant. Can Mr. Putin’s strong hand similarly defend the motherland?