Oregon lawmakers gave final approval to a bill Thursday that would allow a judge to remove guns from a person found to be a threat to themselves or others.

The controversial gun legislation was sent to Gov. Kate Brown on a 31-28 vote by the House as legislators raced to complete their 2017 session.

THANKS TO OUR SPONSOR: Become a Sponsor

Senate Bill 719 is modeled after a Washington initiative approved by voters there last November.

Guns for sale at a Portland gun show. Dave Blanchard / OPB

The issue gained traction in the Oregon Legislature when Republican Sen. Brian Boquist, R-Dallas, supported the measure as a way to reduce the growing epidemic of veteran suicides. The year before, Boquist's stepson, Sethan Sprague, returned home after serving in combat with the U.S. Navy.

THANKS TO OUR SPONSOR: Become a Sponsor

The Oregon bill would allow family members or law enforcement to take steps to remove "dangerous weapons" from someone they think is dangerous to self or others.

Related: 'Lie And Try' To Buy A Gun, Washington Police And Victims Will Now Get Notification

They could petition a judge for an “extreme risk protection order." The target of the order could seek a hearing to contest the loss of firearms or other deadly weapons. But if unsuccessful, the order would last a year and could be renewed.

Republican lawmakers voted unanimously against the bill, with several saying it went too far in taking away gun rights.

House Minority Leader Mike McLane, R-Powell Butte, said the measure's wording was vague about when a person is a danger and said it could be broadly applied. He also warned the measure could put police in a tough position when they attempt to enforce an order by removing guns and potentially certain kinds of knives from someone's home.

House Majority Leader Jennifer Williamson, D-Portland, countered that Second Amendment rights are not unlimited and this bill was a measured way to help reduce gun violence.

The bill's passage also quickly attracted national notice.

Former Arizona Congresswoman Gabrielle Giffords, who became a gun control activist after she was shot and seriously wounded, issued a statement calling it a "responsible bill that helps keep guns out of the hands of an individual experiencing a mental health crisis."