Armies have been storming trench lines for more than a hundred years, but for all the advances in military technology, it is no less harrowing now than it was when soldiers were crossing the muddy battlefields of World War I.

Assaults can be stealthy and surgical, employing surprise, or launched with overwhelming force, using drone strikes, or tanks and artillery. The goal is to breach a maze of protected firing positions and bunkers linked by sunken walkways and guarded by the enemy.

Ukrainian soldiers chose the louder option for an assault on a trench line in May. Some who participated described a fast, well-choreographed operation of a type that is likely to play a pivotal role in Ukraine’s long-anticipated counteroffensive, which U.S. officials suggested on Monday has begun, and which will entail breaking through belts of Russian land mines, tank barriers and trenches.

During the assault in May, Ukrainian mortar units bombarded the position. A tank rumbled out and opened fire. Then armored Humvees bounced forward over a field, firing machine guns, the men said. The assault group fired 3,000 bullets from two American-provided Browning machine guns, one commander named Kozak said, in an indication of the immense ammunition requirements for troops on the offensive.

By the time a squad of Ukrainian soldiers arrived at the rim of the Russian trench, soldiers who took part said in interviews, the defenders appeared deafened by the artillery explosions and too disoriented to fight back.

“It really helped that our tank was working on them,” said one member of the assault team, Sergeant Oleksandr.

An exploding drone also helped. Flown in by the Ukrainians ahead of the troops, it scared the Russians into their bunkers, leaving the approaches to the trench unguarded. “They were all hiding,” Sergeant Oleksandr said.

For months, Ukraine has been training specialized units for such assaults, with allies like the United States and Britain instructing Ukrainian soldiers on how to coordinate artillery, armored vehicles and infantry. Ukraine’s army made available for interviews members of the squad that stormed the Russian trench on May 20 in eastern Ukraine, part of a reconnaissance unit of the 59th Brigade.

Capturing a trench fortification might seem a small-scale operation, especially when compared with one that involves a wave of tanks, air assaults or the thundering violence of artillery like HIMARS.

But taking a trench is difficult soldiering. It depends on careful planning around the peculiarities of the landscape and the weather and the actions of individual soldiers, said Kozak, the commander. He and his soldiers asked to be identified by their nicknames or first names only, for security reasons and in keeping with Ukrainian military rules.

The goal is to get as close as possible before the enemy has an opportunity to fire on the soldiers, who are open and vulnerable as they maneuver.

The attacks are sometimes stealthy. One video of an Ukrainian assault, filmed from a drone and used for training, shows two Ukrainians sneaking up on a trench in the early morning, as Russians apparently sleep, jumping in and walking to the entry of the bunker.

Alternatively, the goal is to force all those in the trench to keep their heads down with a cacophony of firepower. “They should be sitting, hiding, unable to do anything,” said Captain Myron, the commander of an artillery battery that has supported infantry storming trenches.

Choreography is key, he said. The trick is to pound the trench until the infantry is as close as possible — without hitting your own soldiers. “The faster they run, the more chances they have of success and surviving,” Captain Myron said.

Russia’s army has its own tactics for storming trenches, leaning on its advantage in the quantity of howitzers and other artillery, and on an abundance of soldiers.

One is called reconnaissance through combat. In this approach, armored vehicles drive toward a trench line to draw fire from the defenders. Once the firing points are revealed, artillery is called in to bombard the trenches.

Last year, in the battle for Bakhmut, Russia revived the World War II-era practice of sending several waves of a dozen or so convicts forward to overwhelm defenses, at tremendous risk to the attacking soldiers.

Over the winter, Russia formed specialized units of infantry specifically for storming trenches, called Storm units, partially recruited from among special forces veterans. They operate in combination with armored vehicles and artillery, similar to the way the Ukrainian army approaches the problem of capturing trench lines.

The trench at the center of the battle in May, which was near the town of Pisky, had been overrun by a Russian platoon, but the Ukrainians wanted it back, in part to rescue a wounded soldier.

The Ukrainians first tried creeping up, setting out about 1 a.m. on May 20. But the Russians spotted them and opened fire, wounding four of the eight soldiers in the assault group. They retreated, dragging their wounded with them.

Kozak, the commander, interviewed at a base well back from the frontline where he and the assault group were resting, described that setback — then pivoted to trumpet the noisy assault of the following morning, when the Ukrainians deployed their full arsenal and reclaimed the trench.

“By the time the Brownings stopped, the infantry was at the entry to the bunkers,” Kozak saidh.

He said: “You don’t allow the enemy to get oriented, to put his head up, to work with grenades. By the time he understands, our guys are in his trenches.”

At the entry to one bunker, Sergeant Oleksandr shouted to the Russians: “Come out and you will live!”

The Russians started filing out, with their hands up, he said. The squad captured 22 Russians from the newly created storm units

The account could not be independently verified, but multiple Ukrainian soldiers described the details of the assault similarly, and videos provided by the military of interrogations of the prisoners corresponded to their accounts.

The Ukrainian military described the trench assault as a success because it led to the capture of a large number of prisoners, in contrast to the brutal, seesaw and often inconclusive skirmishing in most areas along the front line.

One Ukrainian soldier, who used the nickname Rizhy, or Ginger, said the prisoners were given cigarettes, water and medical kits to treat their wounds. “They all say the same thing: ‘We didn’t want to come here,’” he said.

The prisoners can be exchanged for captured Ukrainians, Rizhy said. “Every captured Russian is a hope for one of our soldiers to return from captivity,” he said.

The soldiers were able to recover their wounded comrade, they said. Both his feet had been blown off in an explosion.

“It’s a miracle he didn’t bleed to death,” Ryzhy said. “I cannot say he was happy to see us, as he was in a very bad state. He just kept asking for water.”

For all the tactical planning necessary to capture a trench, something else is needed as well., the soldiers said.

“We have a word in Ukrainian: fury,” Ryzhy said. “We don’t need to be angry or evil. We need to be furious.”

Maria Varenikova contributed reporting from Pokrovsk, Ukraine