The mayor of Moscow said Tuesday that he will resign two years early so that elections can be held in September. He intends to run in those elections and is likely to be named acting mayor until then. He is also expected to win.

Pundits described the maneuver as a way for the mayor, who was appointed three years ago, to assume legitimacy through an election — while he is still popular enough to prevail.

They also suggested that it was a calculation made by President Vladi­mir Putin, a sign to the public that he is willing to allow elections of mayors and governors. At the same time, there appears to be little chance that an opposition candidate could win and govern Russia’s most powerful city.

Despite the appearance of Machiavellian tactics, the pundits found reason for cheer. The restoration of mayoral elections means an opportunity for real political life to emerge, or so they hope.

The mayor, Sergei Sobyanin, was appointed in 2010 when Yuri Luzhkov was sent packing after 18 years for considering himself too powerful. Sobyanin is popular; the commentators say this is mostly because Muscovites see no alternative to him and speculate that his appeal could quickly erode if an attractive opposition candidate appears or a sagging economy disenchants voters.

Moscow Mayor Sergei Sobyanin. (Misha Japaridze/AP)

Moving the election to September gives Brooklyn Nets owner Mikhail Prokhorov, who had announced that he would run, or anyone else little time to present a serious challenge.

“People may get offended, but don’t they know the name of the game?” said political analyst Boris Makarenko. “Mr. Sobyanin is asking for elections. The election of governors is certainly a good thing.”

Naysayers were few. “Why are the same people who demanded early elections of the State Duma and the president now against early elections of the mayor? Schizophrenia?” Alexei Venediktov, director of Ekho Moskvy Radio, said in a tweet.

Most dramatically, said independent analyst Stanislav Belkovsky, Russian officials believe that being elected proves their legitimacy. “A year or two years ago, that was hardly possible,” he said. “So I think it’s a positive change.”

Putin, he said, was sending the public a positive signal. “Sobyanin’s decision would never be made without Putin’s approval,” he said.

Direct elections of regional governors and Moscow’s mayor were abolished at Putin’s behest in 2004 as he consolidated his top-down authority, called the power vertical. The protests that began in December 2011 over parliamentary elections widely described as fraudulent changed the political calculus. Putin’s authority was weakened, even as he returned to the presidency a year ago after four years as prime minister.

Putin tightened controls. Protesters and opposition leaders were prosecuted and their supporters pressured.Last week, a prominent economist, Sergei Guriev, said he had left the country, fearing reprisals for his support of the opposition. Restrictive laws were passed — on Tuesday, the regional branch of Golos, the country’s only independent election monitor, was declared a foreign agent and fined nearly $10,000 for failing to register as such. Officials have blamed Golos for inspiring protest over the 2011 elections, and the main Golos organization was fined at the end of April for violating the foreign agent law .

Putin critics, who are concentrated in Moscow, called those measures a sign of weakness and fear.

“I’m sure Mr. Sobyanin was feeling uncomfortable that the mayor of the city with the most democratic culture hadn’t faced elections,” said Makarenko, deputy director of the Center for Political Technologies. “Now he has a chance to demonstrate Moscow can hold fair elections, at least at the voting booth.”

Sobyanin’s high popularity ratings allow him to run now with little risk.

“He is popular by inertia,” Belkovsky said. “Muscovites don’t see any alternative.”

A short summer campaign — when people leave the city in droves and go to the country or on vacation — could neutralize Prokhorov or Alexei Navalny, an anti-corruption blogger on trial on embezzlement charges in a case that his defenders call politically motivated. Both would need time to organize and make themselves known to voters.

Muscovites found Prokhorov an appealing candidate when he ran for president last year; he won about 20 percent of the vote in the city. In his blog Tuesday, he said his party would contest the moved-up election but was vague about whether he would run.

“Only the naive do not see that this is a trick,” Prokhorov wrote.

Putin offered no comment, but Sobyanin needs his permission to leave office — he may submit his resignation, but Putin decides whether to accept it. They are expected to meet Wednesday. On a visit to Norway, Prime Minister Dmitry Medvedev spoke approvingly of Sobyanin’s decision.

“He has calculated his political resource and his support resource in such a way that he expects to win,” Medvedev told the Interfax news agency. “It seems to me this is absolutely okay.”

Maybe the outcome was all but ordained, the pundits said, but they celebrated the precedent.

“Elections are back,” Belkovsky said.