NEW YORK — Law enforcement agencies around the country are pledging to crack down on the surge of late-night fireworks activity that is inundating their phone lines with noise complaints, a nationwide cacophony of explosions that officials and vendors attribute to lockdown fatigue.

Fireworks complaints are soaring in communities large and small, leading New York City to corral a task force to target illegal fireworks vendors, whose sales city leaders say are contributing to the plethora of young pyromaniacs running through the streets launching glittery fireballs.

New York City’s complaint lines received about 24,000 calls about fireworks from the beginning of the year through Sunday, compared to fewer than 1,100 complaints during the same time period last year. More than half of those complaints came during the first three weeks of June alone.

The trend has been recorded nationwide. In Syracuse, N.Y., police say they received 1,000 complaints about fireworks this year through Tuesday — more than 10 times as many as they had by the same point last year. Police in Hartford, Conn., say they went from getting a few calls about fireworks each night to about 200 recently. Denver police said that during one week in June, they received 750 calls about fireworks, more than 10 times as many as they received during the same period last year.

After weeks of complaints, some law enforcement agencies are pledging to take more action. Police in Lansing, Mich., said they would deploy more resources to target fireworks activity, with $1,000 fines being handed down to anyone violating the city’s ordinance. Other departments have been confiscating fireworks: In San Bernardino, Calif., police said that they seized about 3,270 pounds of illegal fireworks, made 21 arrests and issued another 11 civil penalties Tuesday.

But there are hurdles to reigning in Americans’ escalating fireworks festivities. Boston police — who reported more than 7,800 complaints in June through Tuesday, up from 139 over the same period last year — said that people threw fireworks at officers responding to complaints this month. And some law enforcement officials say responding to such noise complaints is hindered because it’s often difficult to pinpoint where the explosions are coming from.

“Sometimes we get the call that says, ‘My neighbor is shooting off fireworks.’ Then it’s easier to respond to the house,” said Lt. Ted McClimon, spokesman for the police in Dubuque, Iowa, where complaints about fireworks have quintupled this month. “The more difficult ones are it’s coming from a general area. . . . Then there’s not a whole lot more we can do.”

In densely packed New York City, the consequences of the fireworks activity has been particularly perilous.

A 3-year-old boy suffered first- and third-degree burns and a wound to his left biceps that required stitches after a fireworks shell fired from the street below flew into a window of his family’s Bronx apartment. And in one particularly disturbing video, a homeless man in Harlem was burned when a person — who has not been apprehended — lit a firework on his body before running off with a wide grin on his face.

Other footage has circulated on social media of participants lobbing fireworks at each other and trying to dodge them. Trees, buildings and passersby have become unintended targets as loud booms rattle otherwise quiet communities on sweltering summer nights.

The pyrotechnic problem prompted New York officials to announce Tuesday the formation of a task force of law enforcement and fire department officials in an effort to crack down on “the folks who are profiting off illegal fireworks,” according to Mayor Bill de Blasio (D).

This task force is intended to target the suppliers presumed to be running stashes of amateur fireworks from nearby states where they’re legal to buy.

Police said they have busted at least a handful of fireworks peddlers, according to available data. On Thursday, the New York City Police Department announced it had apprehended 12 people in the Bronx for possessing a stash of fireworks, two assault rifles and a handgun. Another 10 were charged in Staten Island with multiple counts of unlawfully dealing with dangerous fireworks — and unlawfully transporting three alligator carcasses, according to the New York City sheriff’s office.

Two people were arrested in the Bronx on Friday night and charged with the unlawful sale of fireworks, and the 33-year-old alleged buyer was issued a summons. On Tuesday, two men from Queens were busted on the Staten Island Expressway near the Goethals Bridge with a load of the recreational explosives and charged with reckless endangerment and unlawful sale of fireworks.

De Blasio pledged that his task force would get creative in attacking the issue.

“There’ll be all sorts of actions taken,” he said at a news conference Tuesday. “Undercover buys, sting operations, finding where the supply is and cutting it off at the knees.”

The problem adds to a difficult run for the country’s largest police department, facing first the coronavirus pandemic that infected thousands of officers and killed dozens, then protests and unrest across the city.

Police Commissioner Dermot Shea said fireworks play into what he described as a bigger, problematic picture created by the idea that “there are no consequences” for criminal activity, citing criminal justice reforms. The department is also facing an increase in violent crime and shootings, which officials and police union leaders blame on bail reform and the release of many pretrial inmates because of coronavirus concerns.

“We need options,” Shea told a group of reporters Wednesday. “We need to restore basic order to the streets.”

Police officials and observers across the country attribute the rise in fireworks activity to coronavirus fatigue — people stuck at home and looking for ways to alleviate sheer boredom. Retailers are reporting that sales have doubled or tripled compared to a year ago, said Julie L. Heckman, executive director of the American Pyrotechnics Association, a trade group.

“Everybody has been in lockdown mode for over three months,” she said. “There’s nothing to do. You can’t go to a movie theater, there are no festivals, there are no events, nobody’s going on vacation, they’re just stuck at home . . . and they’re deciding that, hey, fireworks are affordable family fun.”

Most states allow at least some consumer fireworks, though the rules vary from state to state, including how old a buyer has to be, what types are permitted and the dates they can be sold, according to the pyrotechnics association.

In some cases, local rules can be stricter than state ones, which is the case in New York City and some surrounding counties. Iowa legalized setting off fireworks in 2017, but Dubuque’s city council outlawed the activity within its own jurisdiction that same year.

In Dubuque, McClimon said, police received 42 complaints about fireworks from June 1 to June 24 last year — and that increased to 221 over the same period this year.

“We’re all kind of scratching our heads,” McClimon said. It’s unclear to anyone why the numbers have jumped, “but it’s definitely up.”

Some of the complaints police have received in Dubuque come from annoyed residents, but others have come from those with post-traumatic stress disorder, anxiety, children with autism or unnerved pets, he said.

“It affects people in many different ways,” McClimon said, adding that his department had assigned more officers to the fireworks detail beginning Wednesday.

Leslie Shalabi, 48, of Dubuque, said she was more aware of the fireworks because Roscoe, her border collie mix, “just freaks out and hides” when the fireworks start. Shalabi said she has not contacted the police about the noise, presuming “they probably have bigger fish to fry.”

Kris Connolly, the building manager at a retirement complex in Dubuque, said she has heard the fireworks for about two weeks, from about 8 p.m. until as late as 3 a.m., and they are audible even to residents who are hard of hearing.

“Put it this way: We live in a stone building, and they’re still loud,” Connolly said.

Some say they have heard the noise without seeing the fireworks overhead somewhere.

“I’ve never actually seen them in the sky, but I’ve definitely — in broad daylight and throughout the night — I’ve heard a lot of it,” said Judah Binkowitz, 22, a barista and waiter at Cafe Eclectic in Memphis. “It almost sounds like professional-grade fireworks sometimes.”

Binkowitz pointed to the general unease sweeping the country — the ongoing pandemic as well as the protests against police violence — and suggested the fireworks might be linked to that.

“A lot of people are almost turning against the system, maybe,” Binkowitz said. “Everyone’s kind of, I wouldn’t say having fun, that’s not a good word for it, but kind of just doing whatever they feel like.”

Berman reported from Washington.