Russian President Vladimir Putin visits residents of temporary housing for flood victims in the far eastern city of Khabarovsk. (ALEKSEY NIKOLSKYI/POOL/EPA)

President Vladimir Putin made a surprise New Year’s Eve visit to Khabarovsk, about 3,800 miles east of Moscow, diverting attention from the misery of suicide bombings in Russia’s heartland and casting himself as the leader of a resilient country capable of overcoming all misfortune. The Winter Olympics were clearly on his mind.

The bombings in Volgograd Sunday and Monday killed 34 people and injured 72, a blood-stained reminder of Russia’s enduring vulnerability to extremist violence and a grim challenge to Putin’s promises of staging carefree Olympic Games in the southern city of Sochi in February.

“We bow down before the victims of the terrible acts of terror,” Putin said in his first public remarks about Volgograd. “We will remain confident, tough and consistent in our fight to destroy the terrorists completely.”

But the verbal and visual centerpiece of his speech was the Khabarovsk region, where residents survived calamitous flooding in August and September that destroyed 12,000 houses and drove 32,000 people from their homes.

“This year, my friends,” Putin said, “I am addressing you not from the Moscow Kremlin, as is the tradition, but from the Far East, where I have arrived to welcome in the New Year with those who have overcome with pride and honor the natural disaster, but cannot yet celebrate this night in their own homes.”

Khabarovsk gave Putin the opportunity to sit down with ordinary-looking Russians instead of speaking from the distance and splendor of the Kremlin. And it afforded him a time zone seven hours earlier than Moscow and St. Petersburg, which meant those big cities saw him sitting with the regular folk on the early evening news instead of at midnight, when the urbanites would be otherwise occupied drinking champagne.

The Khabarovsk trip was so last-minute that Putin’s original and previously recorded New Year message — without any mention of Volgograd — had already been broadcast in Kamchatka, eight hours earlier than in Moscow. By the time the New Year reached Khabarovsk an hour later, the speech had been changed.

Militant leaders have called for attacks to disrupt the Olympics, but tight security in Sochi has apparently led them to target Volgograd, where the mood was tense Tuesday.

In the city of about a million, formerly known as Stalingrad, large gatherings for New Year’s Eve — the biggest holiday on the Russian calendar — were called off. Residents avoided public transportation. An estimated 1,000 volunteers roamed the streets, on the lookout for suspicious characters.

Interior Ministry officials said that more than 5,000 police and troops were on patrol, riding in armored vehicles, on foot and conducting door-to-door searches, checking documents. Nearly 100 people lacking the right papers were detained, they said.

The frenzied police presence in the city obscured the day-to-day violence in other parts of Russia that has become so commonplace it rarely makes headlines.

Although Chechen separatists were once the focus of violence, the resistance and growing Islamic fervor has moved to Dagestan in recent years. Militants in the region have declared war on Russia, angry at corruption they see as fed by Moscow and determined to set up an Islamic republic. They have set off a campaign that has resulted in subway and airport bombings in Moscow, and small scale but steady violence in the south.

Tuesday, an explosive device planted on a car killed an assistant prosecutor in the Dagestan town of Buinaksk. Two men were killed and four police officers were injured when a similar device blew up near a police car in the town of Khasavyurt.

On Monday a shootout in the Khasavyurt region left one attacker and a policeman dead. The same day, a policeman in Kabardino-Balkaria killed a man who started shooting at him after being stopped for a document check.

“There is a lot we will need to do next year,” Putin said in his speech, mentioning improving people’s lives, assuring their security — and hosting successful Games.

“It is only together that we can be truly strong.”