MOSCOW — The unpopular governor of St. Petersburg resigned Monday as part an elaborate plan to get a higher position.

With elections coming in December, the ruling United Russia party has been concerned about its fading support and wanted to get a more voter-friendly face in office in Russia’s second-largest city, the hometown of Prime Minister Vladimir Putin.

St. Petersburg governor Valentina Matviyenko is now in line to become speaker of the upper house of parliament — on paper, the third most important post in the Russian government, and one that’s currently vacant. But to be eligible, she first had to win election this past weekend to a district council seat.

Elections officials announced Monday that she had won two such seats, in races that she joined after the registration of candidates had been closed and that other candidates were denied permission to enter. She won them by 93.7 and 94.5 percent of the vote, the officials said.

Protests over the conduct of the elections led to the arrest last week of the prominent opposition leader Boris Nemtsov.

Named as acting governor Monday was Georgy Poltavchenko, who doesn’t come from a political background. He served for 10 years as a KGB officer and was later head of the St. Petersburg tax police.