The decision to buy a handgun for the first time is typically motivated by self-protection. But it also raises the purchasers’ risk of deliberately shooting themselves by ninefold on average, with the danger most acute in the weeks after purchase, scientists reported. The risk remains elevated for years, they said.

The findings are from the largest analysis to date tracking individual, first-time gun owners and suicide for more than a decade.

The study, posted by the New England Journal of Medicine, does not greatly alter the prevailing understanding of suicide risk linked to gun ownership. But experts said the new evidence was more powerfully persuasive than any research to date.

The study tracked nearly 700,000 first-time handgun buyers, year by year, and compared them with similar nonowners, breaking out risk by gender.

Men who bought a gun for the first time were eight times more likely to kill themselves by gunshot in the subsequent 12 years than nonowners; women were 35 times more likely to do so. (Male gun owners far outnumbered women owners in the study.)

Historically, public health research on firearms has been limited by privacy issues and political opposition. Most previous studies were retrospective.

Studdert’s study, which looked at deaths and gun ownership in California, overcame these obstacles. By California law, all legal gun sales must go through licensed dealers and be reported to the state’s Department of Justice.

The research team integrated this information with two other sources: a California log of deaths determined to be suicides and voter rolls.

By linking gun purchases to the voter registry and suicide data, the team was able to track individuals over time, from October 2004 to December 2016. The researchers checked gun purchases back to 1985 to make sure that individuals in the study were in fact first-time buyers. They also reclassified those who later sold their weapons as nonowners.

This left 676,425 people who bought their first gun during the 12-year period and kept it.

The risk of suicide remained elevated over the entire 12-year duration of the study, and it was in this longer period after the first month that most of the suicides — 52% — occurred. “During this period, the gun acts much more like an ambient risk — it’s always there,” Studdert said.

The majority of people who attempt suicide do not die, said Dr. Matthew Miller, a professor at Northeastern University and an author on the study. “Many suicide attempts are impulsive, and the crisis that leads to them is fleeting,” Miller said. “The method you use largely determines whether you live or die. And if you use a gun … you usually do not get a second chance.”