Nearly 40,000 people were killed by guns in the United States in 2017, according to new data released by the Centers for Disease Control and Prevention. The total brings the country’s gun death rate to its highest point in more than two decades.

The CDC’s WONDER public health database shows that 39,773 people died from firearms last year. That works out to a gun death rate of 12.0 per 100,000 people — higher than the rate of death from car accidents of 11.5 per 100,000 people, once the leading cause of fatal injury.

The last time the gun death rate reached similar heights was in 1996, according to data from the Web-based Injury Statistics Query and Reporting System (WISQARS), another CDC database.

The increase in the gun death rate, at least in 2017, was driven by suicides. Sixty percent of gun deaths last year were self-inflicted. While the rate of gun homicides has fluctuated over the last decade, the rate of gun suicides has steadily increased.

The surge in firearm suicide was not spread evenly among states, according to an analysis by the Educational Fund To Stop Gun Violence. Places with higher rates of gun ownership saw the biggest increases in the gun suicide rate. In Kansas, the rate of gun suicides ballooned 65 percent from 2008 to 2017. Vermont, West Virginia, and Missouri all saw their firearm suicide rates increase by nearly 60 percent over that same period.

Eight states had decreases in their gun suicide rates from 2008 to 2017. New York, Nevada, Mississippi, Maryland, Hawaii, Connecticut, California and Alaska each experienced a fall in the firearm suicide rate between 1 and 8 percent over that 10-year period.

The overwhelming majority of Americans who ended their lives with guns last year were white (91 percent) and male (87 percent).