Less than a week ago, President Vladimir V. Putin of Russia claimed a fifth term with his highest-ever share of the vote, using a stage-managed election to show the nation and the world that he was firmly in control.

Just days later came a searing counterpoint: His vaunted security apparatus failed to prevent Russia’s deadliest terrorist attack in 20 years.

The assault on Friday, which killed at least 133 people at a concert hall in suburban Moscow, was a blow to Mr. Putin’s aura as a leader for whom national security is paramount. That is especially true after two years of a war in Ukraine that he describes as key to Russia’s survival — and which he cast as his top priority after the election last Sunday.

“The election demonstrated a seemingly confident victory,” Aleksandr Kynev, a Russian political scientist, said in a phone interview from Moscow. “And suddenly, against the backdrop of a confident victory, there’s this demonstrative humiliation.”

Mr. Putin seemed blindsided by the assault. It took him more than 19 hours to address the nation about the attack, the deadliest in Russia since the 2004 school siege in Beslan, in the country’s south, which claimed 334 lives. When he did, the Russian leader said nothing about the mounting evidence that a branch of the Islamic State committed the attack.

Instead, Mr. Putin hinted that Ukraine was behind the tragedy and said the assailants had acted “just like the Nazis,” who “once carried out massacres in the occupied territories” — evoking his frequent, false description of present-day Ukraine as being run by neo-Nazis.