Sen. Kamala D. Harris (Calif.) held a town hall meeting at Canyon Springs High School in Nevada, the site of a fatal shooting last year. Former congressman Beto O’Rourke (Tex.) carries in his wallet a photo of a victim of gun violence and often recounts his 8-year-old’s story of hiding in a closet during an active-shooter drill. Sen. Elizabeth Warren (Mass.) has faced questions about gun control at nearly a dozen events.

The 2020 Democratic presidential candidates are embracing gun control more enthusiastically than in any other campaign in recent memory, with emotional appeals against firearms violence and pledges to stand up to the National Rifle Association.

As with other issues, the change reflects the party’s accelerating shift toward voters who live in cities and suburbs and are more highly educated. And it forecasts a general-election battle that could test the party’s liberal surge against a deep attachment to gun culture in many parts of the country, including some areas that Democrats hope to wrest from President Trump.

Perhaps for that reason, the dynamic falls short of Democrats’ endorsement of such broad, novel packages as the Green New Deal and Medicare-for-all. Instead, the candidates are signing on to a patchwork of individual measures such as an assault weapons ban, universal background checks and “red flag” legislation that allows police and family members to petition for the removal of guns from those deemed a threat.

“If their strategy involves trying to bring back Trump voters — voters from moderate to conservative areas — you probably don’t want the gun issue to get in the way,” said Robert J. Spitzer, who has written several books about gun politics. “You want to talk about health care or the economy or, from Democratic perspectives, uniting issues.”

Still, the tone of this group of Democratic candidates is starkly different from those of years past, driven by a spate of school massacres, the resulting activism and a perceived weakening of the NRA’s clout. In prior campaigns, even a candidate such as Bill Clinton, who favored gun restrictions, played up his participation in duck hunts. In 2004, Democratic nominee John F. Kerry dressed in camouflage, lugged a 12-gauge double-barreled shotgun and fired at geese.

“The political calculus has changed pretty dramatically,” said John Feinblatt, president of Everytown for Gun Safety, a gun-control group. “Just look at other presidential campaigns, with John Kerry or Hillary Clinton. Before talking about gun safety, they would talk about their bona fides as hunters and shooters. That’s just not the case anymore.”

In a survey of the 18 Democrats running, six own guns. O’Rourke inherited several from his great-uncle, a former sheriff’s deputy and sharpshooter, but he said they’re not in operating condition. Pete Buttigieg, a Navy veteran and the mayor of South Bend, Ind., owns two antique guns that he doesn’t use, and Rep. Tim Ryan (Ohio) has a Remington 12-gauge shotgun that he won in a raffle and hasn’t used (when he hunts, an aide said, he borrows a gun). Former Colorado governor John Hickenlooper owns a shotgun and a rifle, both used for bird hunting.

Former congressman John Delaney (Md.) also owns a firearm. Perhaps most notably, so does Harris, a former prosecutor who, unlike the other gun owners in the race, has staked out a liberal identity rather than a centrist one.

Four years ago, when Republicans had a sprawling presidential field, The Washington Post found that 15 of the 17 contenders owned at least 40 guns among them.

Most of the Democrats have fired a weapon in one way or another — Warren while growing up in Oklahoma; Buttigieg while serving in Afghanistan and hunting with his father-in-law; Julián Castro while visiting police training facilities as San Antonio mayor — but most did not grow up in a gun culture. Sen. Bernie Sanders (Vt.) fired a gun once while at a Boy Scout camp as a child, his campaign said, but he has never owned one.

But in a significant shift, several candidates made gun control part of their campaign rollouts.

Ryan’s announcement video featured him wearing a black shirt saying, “We Can End Gun Violence,” while Rep. Eric Swalwell (Calif.), who announced his bid Monday, plans to make gun violence a centerpiece of his campaign. One of his first events was holding a “Town Hall to End Gun Violence” on Tuesday night in Sunrise, Fla., with Cameron Kasky, who became a gun-control activist after 17 students and staff members were killed at his high school in Parkland, Fla.

Gun control still trails other issues in polls of what is important to left-leaning voters, but its profile has risen. The asymmetry is less pronounced than in previous years, when the voting bloc of conservatives deeply focused on gun rights was not matched by a similar intensity on the left.

Many Democrats blamed losses in the 1994 midterm elections and the 2000 presidential race largely on gun issues and for years after were wary of supporting even modest gun-control measures.

That began to change after the 2012 massacre of 20 students and six adults at Sandy Hook Elementary School in Newtown, Conn., and shifted even further after the mass shooting at Marjory Stoneman Douglas High School in Parkland in February 2018, which spawned a wave of gun-control activism by teenagers.

Before the 2018 midterm elections, 69 percent of registered voters said gun policy was “very important” to them, according to a survey by the Pew Research Center; Democrats recaptured the House in that cycle. The issue ranked ahead of taxes and immigration but behind Supreme Court appointments, health care and the economy.

In individual races, gun control played a bigger role. A Democrat won the New Mexico governor’s mansion in a race in which gun issues were prominent. In Nevada, Democrats won top statewide elections campaigning for universal background checks.

In Michigan, Gov. Gretchen Whitmer won on a platform of universal background checks, banning bump stocks and prohibiting gun possession for those guilty of violent crimes.

Rep. Lucy McBath (Ga.), who ran after her son was fatally shot, made gun control a centerpiece of her campaign, defeating a Republican incumbent in an Atlanta suburban district where Democrats hadn’t won since 1979.

A significant factor in the changed landscape is a perceived weakening of the NRA, which for years was considered a near-invincible political force. The group has faced accusations that Russia sought to infiltrate it to gain political influence, while figures such as former New York mayor Michael R. Bloomberg have spent significant sums to back gun-control candidates.

A spokeswoman for the NRA did not return messages seeking comment.

Other gun rights activists, however, warned that the Democrats may be overestimating the support for firearms curbs, and they say that 2020 — with the presidency at stake — will not be the same as 2018.

Michael Hammond, legislative counsel for the Gun Owners of America, said gun-control activists have believed the tide was shifting their way before, only to be disappointed later.

“We’re in the same situation now as following Newtown, following Columbine — a lot of Sturm und Drang but no shift in the fundamental political dynamics,” he said. “Guns are, in many parts of the country, an animating issue that will fundamentally make a difference if they believe — and I don’t think they believed in 2018 — that their gun ownership rights are actually in danger.”

In a focus group of building trade union members, held in Washington on Wednesday, several local leaders said that the Democrats need to assure voters that their hunting and hobbies will be safe.

“I want to hear them say, ‘I’m not going to take your guns,’ ” said Patrick J. Corrigan of the Cleveland-based Heat and Frost Insulators and Allied Workers Local 3. “That’s a big issue for my members.”

Democrats are betting that the atmosphere has in fact changed. When the House passed legislation last month to expand background checks, only two Democrats voted against it. Every senator running for president backs legislation that would enhance background checks.

“What’s striking on gun violence prevention is how much they’re aligned,” said Peter Ambler, executive director of Giffords, a group created by former congresswoman Gabrielle Giffords (D-Ariz.) and her husband, Mark Kelly, after she survived a 2011 assassination attempt. “Even with all these candidates and this fragmented field, not a single candidate is pointed at some kind of libertarian approach on guns. This is not where our politics was even in 2008.”

More cracks could show as the candidates are pressed for specifics. Everytown for Gun Safety is preparing a candidate questionnaire that will address, for example, a proposed repeal of the Tiahrt Amendment, which restricts the dissemination of federal information about gun tracing.

For now, the candidates are pressing ahead. Warren’s campaign asked for a member of a group called Moms Demand Action to introduce her in Nevada. Numerous candidates — including Buttigieg, Harris and Sen. Cory Booker (N.J.) — have asked for gun-control activists to attend events.

Other Democrats are repudiating previous positions.

Sen. Kirsten Gillibrand (N.Y.) earned an “A” rating from the NRA when she was a congresswoman representing a rural Upstate district. She told Newsday in 2009 that she stored two rifles under her bed. “If I want to protect my family, if I want to have a weapon in the home, that should be my right,” she said.

After some noted the potential safety hazard of storing guns under the bed — she had an infant and a 5-year-old at the time — she said the ammunition was kept separate from the guns. She also announced that she had started storing the rifles elsewhere.

A campaign spokeswoman said that Gillibrand no longer owns firearms, but it is unclear when or how she got rid of them. Gillibrand has also shifted her views on guns, saying she was “embarrassed” by her past positions, which changed when she became a senator.

“After I got appointed, I went down to Brooklyn to meet with families who had suffered from gun violence in their communities,” she told CBS’s “60 Minutes” last year. “And you immediately experience the feeling that ‘I couldn’t have been more wrong.’ You know, I only had the lens of Upstate New York.”

Sanders, who represents a state where hunting is part of the culture, faced scrutiny during his first presidential campaign in 2016 for at times opposing gun restrictions. He has since spoken about the need to pass legislation.

For the moment, the Democrats’ views have largely converged. Booker has framed the debate — as Democrats depict many issues these days — as a conflict between corporations and people.

“I am tired of going to funerals where parents are burying their children,” Booker, who lives in downtown Newark, said at a CNN town hall event. “We are going to bring a fight like the NRA has never seen, if they’re going to defend corporate gun manufacturers more than the American people.”