Republican House lawmakers voted in unison against the bill, joined by three Democrats: Reps. Candie Sweetser of Deming, Patricio Ruiloba of Albuquerque and Harry Garcia of Grants. Democratic Rep. Joseph Sanchez of Alcalde did not vote.

Lawmakers are considering a raft of gun safety initiatives that also would allow judges to authorize removing guns from people who may be suicidal or bent on violence, expand child neglect laws to encompass the secure storage of household firearms, and ban gun possession for people under permanent protective orders for domestic violence.

The bills have stirred a backlash from county sheriffs across much of the state who threaten not to enforce gun regulations that they find unconstitutional. County commissions have been quick to sign on to supportive resolutions.

"This is rural versus urban, and I don't appreciate my community having to take these things," said GOP Rep. Gail Armstrong of Magdalena during the final House floor debate. "I don't know how you will police this in rural New Mexico."

Lujan Grisham and Democratic legislators say the background-check bill is both constitutionally sound and popular.

"New Mexico is indeed facing a public health crisis involving gun violence that is literally killing people in our community on a daily basis," said first-term Democratic Rep. Melanie Stansbury of Albuquerque. "I don't know how we can afford not to enact this legislation."

Background checks against a federal database of prohibited buyers are designed to weed out prohibited buyers such as convicted felons and people with severe mental disorders.

Current state law leaves out the background check requirement for many private, person-to-person sales arranged over increasingly popular online marketplaces for firearms.

The New Mexico legislation provides exceptions to background check requirements for antique weapons, sales between family members and the lending of guns at sport shooting clubs.

Federally licensed firearms dealers will perform checks for a fee of no more than $35, under the new legislation.