Ukraine’s military launched an overnight strike on the Russian-occupied city of Makiivka, showing that it could still attack targets deep behind Russian lines as its troops fight in grueling trench warfare in a counteroffensive to reclaim land.

Both Ukrainian and Russian officials indicated that the Tuesday night attack in Makiivka was significant, but they differed on whether it had struck a military or civilian area. And the strike had a symbolic resonance because Makiivka is where Ukraine, in January, dealt Russia one of its largest losses of life in a single strike since Moscow invaded almost 18 months ago.

A video shared online by Ukraine’s military showed a huge fireball lighting up the night sky over Makiivka, in the Donetsk region of eastern Ukraine. The military said that a “Russian base” had “ceased to exist” in the city thanks to Ukraine’s forces, while Tass, the Russian state news agency, reported that one man was killed and 68 civilians were wounded. Neither claim could be independently verified.

The strike came four weeks into Ukraine’s slow but intense campaign against Russian forces, who have dug into the south and east with miles of trenches and minefields across exposed open fields. Since the counteroffensive began, Ukrainian forces have made small gains, and on Wednesday, Gen. Oleksiy Hromov, a deputy commander of operations in the military’s general staff, gave some details of their progress.

He said that Ukraine had recaptured nine settlements in the past month, mostly small farming villages, and about 62 square miles. He also said the “hot contact” line, where Ukraine was directly engaged with Russian troops, was about 745 miles long.

The numbers could not be independently verified, but they appeared to be consistent with previous reporting by The New York Times — and with the bitter, yard-by-yard nature of the fighting as Ukrainian soldiers and civilians have described it. Russian officials have said that Ukraine’s campaign is being repelled.

For months, as Ukraine has prepared and launched its counteroffensive, and as Russia has attacked before that — staggering on many fronts and capturing only the eastern city of Bakhmut — the two sides have traded long-range strikes on targets far from the front line.

While Ukraine has used Western-supplied weapons, such as the HIMARS rockets, to attack Russian supply lines and arms depots, Russia has frequently targeted civilian centers, bombarding Kyiv, Ukraine’s capital, 17 times in May alone.

Although many of the Russian missiles and drones are downed by Ukraine’s air-defense systems, the attacks have left many Ukrainians in Kyiv on edge and ready to race to bomb shelters. Nerves were running high again on Wednesday after a man detonated an explosive device in a courthouse in the city, setting up a standoff that ended with him dead and two responding officers injured. The authorities did not name the man, and his case did not appear to be tied to the war.

In the strike on Makiivka on Tuesday night, videos geolocated by The Times confirmed an explosion on the city outskirts: An initial explosion ignited multiple secondary explosions and flares before setting off a much larger blast, suggesting the site might have been an arms depot.

Russia’s Ministry of Defense did not immediately respond to Ukraine’s claims about the strike, but pro-Russian officials in Makiivka accused Ukraine of using Western-supplied, long-range rockets and artillery to attack civilians. Tass quoted a local official, Igor Kimakovsky, as saying that HIMARS rockets and artillery had hit “peaceful” districts of the city. Those claims could also not be independently verified.

It was a HIMARS strike that killed at least 63 Russian soldiers — and possibly hundreds more — in a barracks in Makiivka on New Year’s Day. The attack drew criticism of the Russian military from some influential supporters of Moscow’s war effort and led Russia’s Defense Ministry to claim that it had made retaliatory strikes on Ukraine.

At the time, the Russian authorities blamed their troops in Makiivka for exposing their location by using cellphones, saying the data had enabled a strike by Ukrainian forces equipped with long-range weaponry from Western allies.

Makiivka, near the Russian-occupied city of Donetsk, lies only about 10 miles from Ukrainian-held Avdiivka to the northwest — well within the roughly 50-mile range of the HIMARS rockets the United States has sent to Ukraine. The HIMARS system, military analysts say, is most effective against stationary targets that can be identified in advance and pinpointed, such as ammunition dumps, infrastructure and troop concentrations.

Anatoly Kurmanaev and Malachy Browne contributed reporting.