BOSTON — State senators Thursday joined their House colleagues in approving a ban on bump stocks used to make semi-automatic rifles fire more quickly, like those used by the gunman in the Las Vegas massacre.

The measure, which was tacked onto a supplemental spending bill, expands the state's ban on machine guns to include "bump stocks" and "trigger cranks" designed to modify the firing rate of a firearm, rifle or shotgun. Law enforcement officers and licensed gun collectors are exempted from the ban.

Anyone found in possession of the devices could face 18 months to life in prison.

House lawmakers approved the ban by a vote of 151 to 3 on Wednesday, with no debate or public hearings. The Senate followed on Thursday.

Differences between the House and Senate versions will have to be worked out before the bill is sent Gov. Charlie Baker for consideration.

Baker, a Republican, said he would sign a ban if approved by lawmakers.

If that happens, bump stock owners would have 90 days to dispose of the devices or sell them to someone living outside the state.

"We as a civilized society cannot allow this type of device to be in private hands," Rep. David Linsky, a Natick Democrat and chief sponsor, said in a House floor speech Wednesday. "This device has one purpose only, to kill or wound as many people as possible in a short period of time. We have to draw the line somewhere."

Bump stocks are cheap, legal accessories that can be installed on a semi-automatic rifle. Replacing a traditional stock and pistol grip, bump stocks use a rifle’s recoil to allow a user to fire more rapidly without seeming to pull the trigger for each round.

Stephen Paddock, the gunman who killed 58 people and wounded more than 500 others at a Las Vegas music festival, had 23 guns and at least a dozen bump stocks in his possession, police have said.

A similar proposal was filed by Senate Minority Leader Bruce Tarr, R-Gloucester, and House Minority Leader Brad Jones, R-North Reading.

Unlike the Democratic plan, their proposal would have provided a possible path to ownership for gun enthusiasts who legally purchased the devices.

The Gun Owners’ Action League, the Massachusetts affiliate of the National Rifle Association, criticized Democratic plan as a "flat-out attack on our civil rights" and urged lawmakers to reject it.

Jim Wallace, GOAL’s executive director, said the bill is too vague and would give state officials too much regulatory power over gun owners.

“As written it will include any gun including a bolt-action rifle,” he wrote in an email blast to members following Wednesday's House vote. “In other words, if a bolt-action rifle is modified so that the bolt can operate with more ease, or less friction, it could be considered a felony.”

The Senate plan clarified the ban to include a specific definition of bump stocks and trigger cranks.

In remarks ahead of Thursday's Senate vote, Tarr said he hoped for public hearings on the proposal but agreed to join with Democrats to pass the legislation.

"Public safety and protecting the integrity of our laws should never be a partisan issue," Tarr said. "We've worked together to come up with a reasonable way to address what is clearly the ability for some to circumvent our licensure laws for firearms."

A proposal filed by Linsky last week would have outlawed high-capacity rifle magazines "grandfathered" under a 1994 ban -- in addition to bump stocks.

House Democrats ultimately decided to drop that provision from the measure they approved Wednesday, which passed with bipartisan support.

"We're still committed to the magazine issue, but we're going to save that debate for another day," Linsky told reporters. "It's a more difficult issue."

In Congress, restrictions on bump stocks are also gaining traction after Republicans, who have for decades resisted limits on guns, signaled an openess to banning the accessory.

Rep. Seth Moulton, D-Salem, has teamed up with Rep. Carlos Curbelo, a Florida Republican, on bipartisan legislation to outlaw the devices.

The National Rifle Association has said the devices should be "subject to additional regulations" but has stopped short of calling on Congress to ban them.

Last year, Attorney General Maura Healey unilaterally expanded the state's 30-year ban on assault weapons to include "copycat" weapons that look like or can be modified to mimic assault weapons. Her decision, which faces a legal challenge from the NRA, didn't include bump stocks or other accessories.

Christian M. Wade covers the Massachusetts Statehouse for North of Boston Media Group’s newspapers and websites. Email him at cwade@cnhi.com.

Recommended for you