The saboteurs managed to place four explosives on a Russian freight train carrying diesel and jet fuel, roughly 3,000 miles from the Ukrainian border. But more important than the destruction of the train, Ukrainian intelligence officials said, was the timing of the blast.

They needed it to blow up as the 50 rail cars were traveling through the nine-mile-long tunnel through the Severomuysky mountains, the longest train tunnel in Russia.

The Ukrainians were hoping to compromise a vital conduit for weapons being shipped to Russia from North Korea, at a moment when Ukrainian forces on the front are struggling to stave off relentless Russian assaults. Trains can be replaced and tracks quickly repaired. But serious damage to this tunnel, which took decades to build, might not be so easy to fix.

Russia and Ukraine continue to battle on a large scale, both on the ground and with aerial strikes. Russian officials accused Ukraine of attacking a Russian city, Belgorod, on Saturday, killing at least 20 people and injuring more than 100 others, in apparent response to a huge Russian missile barrage on several Ukrainian cities the day before.

But guerrilla tactics — including sabotage, commando raids, targeted assassinations and attempts to blow up ammunition depots, oil pipelines and railways — have taken on added importance as the two sides fail to make substantial advances at the front.

So at 5:20 p.m. on Nov. 29, a fire ripped through the tunnel, Russian Railways reported. Russian media broadcast footage of flames around the tunnel entrance, and officials said the explosion was caused by “the detonation of an unidentified explosive device.”

The extent of the damage is unclear. Each side gave diverging assessments of the explosion’s impact. But a second explosion on an alternate train route nearby followed within 48 hours. Combined with other acts of sabotage in Russia and behind Russian lines in occupied Ukraine, the explosions signaled Kyiv’s increasing reliance on irregular tactics to assist conventional forces desperately defending against intensifying Russian assaults.

“The war in Ukraine is changing right now, as Ukraine increases the number of guerrilla operations against Russian forces and decreases conventional operations,” said Seth G. Jones, an analyst at the Center for Strategic and International Studies who previously served as an adviser to the commanding general of the U.S. Special Operations Forces in Afghanistan. “The goal is to deliver death by a thousand cuts.”

Russia, with three times the population of Ukraine and a far larger military industrial complex, currently has the advantage in conventional warfare, especially with sustained Western military assistance for Ukraine in doubt. But military analysts point out that an occupying power is historically more vulnerable to attacks by saboteurs working for, or sympathetic to, the country under invasion. And the Kremlin’s scorched-earth campaign in Ukraine continues to fuel resistance in occupied territories.

With attacks on Russian occupation officials continuing, the Ukrainian National Resistance Center, which was created by Ukraine’s military to train and coordinate partisan networks in occupied territories, said this month that Russia is dedicating an increasing number of elite forces to rooting out the underground groups.

Despite the heightened vigilance, Ukrainian partisans said they managed to blow up a freight train on Dec. 15 as it was transporting ammunition and fuel from Russian-occupied Crimea to Melitopol, in southern Ukraine.

The earlier attacks on rail lines beyond the Ural Mountains — a natural barrier that has long kept much of the nation’s vital military infrastructure safe from enemy attack — offers a window into the shadowy world of guerrilla tactics and how they can have outsize effects.

While Ukrainian officials often say little about operations inside Russia, this time they wanted the Kremlin to have little doubt about who was behind the attacks.

“Russian special services should get used to the fact that our people are everywhere,” a senior official with the Ukrainian intelligence service, known as the SBU, said after the second rail attack, offering details of the operation on the condition of anonymity for security reasons. The details of the attacks were confirmed by the official and two other senior Ukrainian officials familiar with the operation, and corresponded with details released by the Russia authorities, videos from the scenes and reporting by Russian media outlets.

The Russian security services, known as the FSB, said soon afterward that they had detained two people suspected of organizing several arson attacks on behalf of Kyiv, including one man they said installed magnetic mines on the train that exploded in the tunnel.

Russian Railways claimed that 120 workers cleared the tunnel in a matter of days and said that train traffic had resumed. Ukrainian intelligence officials said it could take months to properly restore the mountain pass to full working order. It is impossible to verify either account.

Ukraine is not alone in using guerrilla tactics. Russia is also employing spies, saboteurs and collaborators, and it targets trains, as well. Polish authorities convicted 14 people on Dec. 19 on charges of undertaking sabotage and propaganda activities under the direction of Russian intelligence, Poland’s Interior Ministry said in a statement. Their main targets, the ministry said, were “trains transporting military and humanitarian aid to Ukraine and preparing for train derailments.”

Trains are vital to both sides, as they were designed to be the backbone of the Soviet supply system. But the bold attack on the tunnel in Russia’s Far East is likely to be of particular concern to the Kremlin, said Emily Ferris, a research fellow specializing in Russia at the Royal United Services Institute in Britain.

“This is something that has bothered Russia for over a century — how to secure these really long and vulnerable rail lines,” she said.

There are only two rail lines that cover the vast expanse of Russia: the trans-Siberian, which stretches 5,772 miles from Vladivostok to Moscow, and the newer Baikal-Amur Mainline, or BAM, which runs from near the Pacific Ocean for some 2,600 miles before linking up with the trans-Siberian line.

They are the only lines that link Russia to China and, amid a surge in trade with Beijing, the lines are more vital than ever, economically and militarily, for the Kremlin. But they are a challenge to guard because they traverse the Siberian plains, dense forests and the open steppes.

Russia and Belarus’s interlinked railway systems facilitated the swift movement of troops and equipment between the two countries, allowing Belarus to act as the launchpad for Moscow’s assault on Kyiv from the north in February 2022.

Strikes on that rail network added to the logistical struggles of the Russians in the early days of the war and contributed to the Kremlin’s failure to seize Kyiv, Ms. Ferris said.

Since then, attacks inside Russia have continued, by agents working for Ukraine, but also including loosely affiliated groups of self-described Russian anarchist groups, she said.

In November, the British military intelligence agency reported, “Seventeen months after the first incidents were reported, sabotage of Russian railways by antiwar activists continues to represent a significant challenge for the Russian authorities.”

Research by the independent Russian media outlet Mediazona found that, as of October, 76 cases of probable railway sabotage had been filed with the courts in Russia since the invasion. At least 137 people, the vast majority of them under 24, had been prosecuted, the agency reported.

Ukraine’s military intelligence agency said in late November that its agents were targeting rail infrastructure across Russia, claiming responsibility for a spate of fires that had destroyed structures used to house sensitive equipment that performs a wide range of operations, including platform control, train monitoring and signaling.

Ukrainian sabotage efforts go beyond trains. Ukrainian intelligence officials said partisans killed the Russian-appointed deputy head of the occupied Luhansk region, Oleg Popov, in a car bombing; other agents operating in Moscow shot and killed a former Ukrainian lawmaker who defected to Russia, Illya Kyva.

At the same time, Russia, which has long used irregular tactics to achieve political goals, continues to send sabotage and reconnaissance groups to infiltrate Ukraine.

Ukrainian officials said they believed Russia was behind the poisoning of the wife of Ukraine’s military intelligence chief last month, part of a campaign targeting Ukraine’s senior leadership. (Asked about the poisoning, the Kremlin’s spokesman said “Ukraine blames Russia for everything,” and called it “habitual accusation.”)

Ms. Ferris said it was impossible to judge the lasting effect of Ukraine’s attack on the BAM line, she said, but “the Russians would be ill advised to ignore it.”