A new sign went up a few miles from the front line recently on the main billboard of an occupied town in Ukraine’s Luhansk region.

“Vote for our president. Together we’re strong,” read the sign in the white, blue and red colors of the Russian flag, according to Anastasiia, a resident.

The message was clear to her: that the president was Vladimir V. Putin of Russia, not Volodymyr Zelensky of Ukraine, and that Mr. Putin was the only choice in the Russian presidential vote taking place in the occupied parts of Ukraine over the past three weeks.

Mr. Putin long ago transformed Russian elections into a predictable ritual meant to convey legitimacy to his rule. In the occupied territories, this practice has the additional goals of presenting the occupation as a fait accompli and identifying dissenters, said political analysts and Ukrainian officials.

“Elections in these regions fix the idea that they have the same laws and procedures as the rest of the country,” said Ilya Grashchenkov, a Russian political scientist who is advising a long-shot candidate running against Mr. Putin. That has the effect, he said, of weaving them into the fabric of Russian statehood.

For many in the occupied territories, the electoral ritual is unfolding under the watchful eyes of armed soldiers.