His girlfriend told him not to buy the electric scooter.

But Alfonso Villa Muñoz was intrigued. He was working in a Brooklyn bodega last August when a delivery man said he knew someone selling one for $700. Mr. Muñoz said yes.

The scooter was cherry red with the number 7 on the front. Under the seat was an extra-large lithium ion battery. When it needed charging, Mr. Muñoz would remove the battery from the scooter and use both hands to lug it up to the couple’s third-floor apartment in College Point, Queens.

A month later, the battery exploded in the living room, unleashing flames that engulfed the apartment. Mr. Muñoz screamed for their 8-year-old daughter, Stephanie, who was asleep. He could not breach the wall of black smoke to get to her. Stephanie died from smoke inhalation.

“It’s like you bring in death and destruction to your house, and not only to you, to everybody around you,” said Mr. Muñoz, 36, pulling off his glasses to wipe away tears. “You could lose everything.”

E-bikes and e-scooters have flooded New York City’s streets in recent years, embraced by delivery workers and commuters alike as an economical and efficient new way to get around. But even as the devices have grown in popularity to become nearly ubiquitous, the batteries inside them have made New York City an epicenter for a new kind of ferocious and fast-moving fire.

These fires are “uniquely dangerous,” warned Laura Kavanagh, the city’s fire commissioner. With little or no warning, the batteries can ignite, leaving seconds for people to escape. In just three years, lithium battery fires have tied electrical fires and have surpassed blazes started by cooking and smoking for major causes of fatal fires in the city.

Reasons for the uptick of these fires are myriad. They include a lack of regulation and safety testing for individually owned devices, hazardous charging practices (like using mismatched equipment or overcharging) and a lack of secure charging areas in a population-dense city with numerous residential buildings, where most fires start.

But for New Yorkers who rely on e-bikes and other battery-powered devices to make deliveries or otherwise earn a living, the fires have forced a choice between financial stability and personal safety.

Across the country, over 200 micro-mobility fire or overheating incidents have been reported from 39 states, resulting in at least 19 fatalities, according to the United States Consumer Product Safety Commission. But the organization emphasized that the problem is particularly acute in densely populated areas like New York City. In London, lithium battery fires are the fastest-growing fire risk, with 57 e-bike fires and 13 e-scooter fires this year, according to the London Fire Brigade.

In New York, lithium battery fires have killed 13 people so far this year, including four people in a blaze that started in an e-bike store in Chinatown on Tuesday. A total of 23 people have died in battery fires since 2021. This year, there have been 108 fires so far, compared with 98 fires for the same period last year.

During the pandemic, when public transit was compromised and the demand for food deliveries skyrocketed, a ready supply of cheap e-bikes and e-scooters of questionable quality cropped up across the city.

New Yorkers looking for good deals pounced. With many residents living in tight quarters, they would charge their batteries in their apartments.

But once a lithium battery overheats or malfunctions, all bets are off; the speed and impact of lithium battery fires make them particularly perilous, especially when people live close together.

This has pushed more and more landlords to ban e-bikes and other e-mobility devices, while New York’s leaders have worked to prevent the fires on several fronts. In September, New York will become the first city in the nation to ban the sale of e-bikes and other e-mobility devices that fail to meet recognized safety standards.

City and fire officials have also pushed for greater state and federal oversight of the devices, shut down illegal battery charging stations, worked with food delivery apps to educate workers and shown public service messages with exploding batteries.

“I have very, very serious concerns in the short term,” Commissioner Kavanagh said. “These devices are here now, and there’s lots of them.”

In March 2019, Citi Bike, the popular bike-share program, was charging its pedal-assisted e-bikes in its Brooklyn warehouse when a fire broke out.

It started with a loud bang like a pistol shot. Then came flames with chrome-colored sparks flying out and a rush of heat. “In an instant, the batteries began to explode into flames one by one, like a domino effect, going from right to left,” recounted a witness in the fire marshal’s report. “Within 10 seconds, the entire top row became a mini inferno.”

Though e-bike fires were just becoming a problem, fire officials had been aware of the dangers of lithium batteries for years. They initially focused on the highly regulated batteries in energy storage systems, which hold backup electricity for buildings.

Leo Subbarao, who worked as a fire protection engineer in the department until 2019, recalled there had been talk back then about whether the city should allow a battery storage system to be placed under an elevated subway track. Fire officials quickly put an end to that.

“The technology was moving forward so fast, and we were trying to catch up with regulations,” said Mr. Subbarao, who lectures at John Jay College of Criminal Justice.

After the Citi Bike fire, battery safety became a priority for the bike-share program. It uses only batteries that have been certified to safety standards and have built-in sensors to monitor their condition in real time, as well as a shut-down switch. In the warehouse, each battery is inspected and charged in a rack with fireproof concrete dividers. There has not been a major battery fire since at Citi Bike since these protocols were added.

Fire officials also revised the city fire code, which now requires buildings to provide safety measures, like a dedicated charging room with a sprinkler, when more than five e-bikes are charging.

But the fire code does not cover the individual use of e-bikes, and fire inspectors do not enter private dwellings to check for safety violations without a warrant. So there are no safeguards to prevent what happened to Josue Mendez.

Mr. Mendez, a delivery worker, had plugged an e-bike battery to charge beside his bed in his Bronx apartment in 2021. He woke up to see it “throwing smoke,” and then it exploded like fireworks. Mr. Mendez and his family sprinted out the door, flames chasing them. “Thank God we were able to come out alive,” said Mr. Mendez, 31, a Mexican immigrant, who was burned on his back and arms.

After the fire, Mr. Mendez’s family moved to another building in northern Manhattan. Earlier this year, the building banned e-bikes, but it did not ban the batteries themselves, which pose the most danger. So Mr. Mendez parked his e-bike on the street and took the batteries upstairs to charge.

Lithium batteries, which have been used commercially since 1991, have a history of sparking fires in Dell notebook computers, Samsung smartphones and hoverboards, leading to huge recalls.

But after years of research to “engineer the hazard out,” lithium batteries have generally become safer, said Adam Barowy, a fire protection engineer who specializes in lithium batteries for the Fire Safety Research Institute at UL Research Institutes, a nonprofit.

Inside a lithium battery, a number of small cells are bundled together. When the battery is used, lithium ions move between the electrodes inside each cell, generating an electrical current. The danger occurs when a cell goes into “thermal runaway,” a chain reaction in which heat develops extremely quickly, creating a threat of fire and sometimes explosion. A cell can be sent into thermal runaway by overcharging, a manufacturing defect or even the heat from an adjacent cell in the battery pack that is already in thermal runaway.

But there is market pressure on manufacturers to add more energy to batteries, which can push safety limits. The batteries in e-bikes contain far more energy than in cellphones and, as a result, are more destructive in a fire.

“The problem is that we’re trying to squeeze too much energy out of these batteries, and that makes them more dangerous,” said Nikhil Gupta, a professor of mechanical and aerospace engineering at New York University’s Tandon School of Engineering.

More powerful batteries are only part of the reason that so many e-bikes and e-scooters are catching fire. Electric cars and energy storage systems, which are being increasingly adopted to fight climate change, require far more energy and yet have fewer fires.

The difference, according to battery and fire safety experts, is that those industries are closely regulated and have to go through several layers of testing to show their products are safe. Until recently, e-bikes and e-scooters have not received similar scrutiny.

Victoria Hutchison, a senior research project manager at the Fire Protection Research Foundation, said the lack of safety regulations and testing requirements has allowed cheaper, low-quality devices and batteries of questionable safety to enter the market. “That’s really the root of the problem,” she said.

These products of questionable origin also make it difficult for victims to sue. The batteries are often destroyed in the fires, and even when they can be recovered, they can lack identifying marks to trace back to a specific manufacturer or distributor who can be held legally responsible, according to lawyers and fire experts.

The Consumer Product Safety Commission has increased its oversight of e-mobility devices, urging companies to “comply with established voluntary safety standards or face possible enforcement action.” And New York lawmakers, including Senator Chuck Schumer, have proposed a federal safety standard for lithium batteries used in those devices.

Ash Lovell, the electric bicycle policy and campaign director for PeopleForBikes, the national trade association for bike manufacturers, which has called for more safety regulations, said the low-quality batteries do not reflect the overall e-bike industry. Most of their members also sell e-bikes in Europe and have already met robust safety regulations there, she said.

When Mr. Muñoz brought home the red e-scooter from the bodega, it did not come with any safety certifications. He did not know to be worried.

He met his girlfriend, Marilu Torres, at a party in Sunset Park, Brooklyn, in 2013. He drank too much and left his sweater and an ID card. She returned them. They moved in together, and the next year, Stephanie was born.

They called her “gatito,” kitten in Spanish, because she made meowing sounds when she was young. She had a big heart for all creatures, even alligators and tarantulas. “She would like something odd and make it her own,” said Jefferson Jimenez, 19, Ms. Torres’s son.

Mr. Muñoz said he bought the e-scooter so Mr. Jimenez could ride it. He also used it to make extra money delivering Grubhub orders.

But then the trouble started. Mr. Muñoz was riding it one day when the battery died. He had to push the scooter home. “I’m going to throw it in the garbage,” he said he told himself. When he plugged in the battery, it would not charge.

His co-worker at the bodega brought in another charger, and then another, until one finally worked. That night, Mr. Muñoz brought the charger and battery to his apartment and went to sleep. Hours later, he woke up to smoke “like the darkest thing you have ever seen.”

With severe burns on his face, arms and hands, Mr. Muñoz spent two months in the hospital. He was there when he found out that the cause of all the misery and devastation had been the battery.

Ms. Torres said the e-scooter she never wanted has “broken part of me.”

Susan C. Beachy contributed research.