BOSTON (Reuters) - Vermont lawmakers on Wednesday approved a measure to legalize recreational use of marijuana, which if not vetoed by the governor would make the state the ninth to legalize the drug and the first to do so by legislation rather than ballot initiative.

The U.S. state’s House of Representatives voted 79-66 for the measure, which was attached to a bill increasing penalties for the possession and sale of the opioid drug fentanyl. The measure, which would take effect in July 2018 and allow adults 21 and over to buy and use the drug, was passed by the state Senate last week in a 20-9 vote.

A spokeswoman for Governor Phil Scott, a Republican, said he would need to consider the details of the legislation before deciding whether to sign, veto or let it pass into law without his signature.

“On the issue of legalizing marijuana, the Governor has said he is not philosophically opposed, but we must ensure certain public safety and health questions are answered,” Scott spokeswoman Rebecca Kelley said in an e-mail.

The Marijuana Policy Project, a pro-legalization group that had backed the measure for multiple years, applauded the vote,

“Vermont lawmakers made history today,” said Matt Simon, the group’s New England political director. “It’s time for Vermont to move forward with a more sensible marijuana policy.”

Opponents blasted passage of the measure and urged Scott to veto it.

“This is about opening the doors to a new addictive industry being funded by Big Tobacco that will install retail pot shops in Vermont neighborhoods,” said Kevin Sabel, president of anti-pot group Smart Approaches to Marijuana. “We will continue to give a voice to parents, and public health and safety experts to encourage Governor Scott to choose people over profit and veto this harmful legislation.”

Neighboring Massachusetts and nearby Maine have also legalized the drug, doing so after statewide ballot initiatives showed that a majority of voters approved the idea. That was not an option in Vermont, where state law does not allow for ballot measures of that kind.

Lawmakers in nearby Rhode Island are contemplating a similar measure.

Approval of the legislation comes at a time that many public health advocates are focusing on the problems caused by rising rates of addition to opioid painkillers including heroin and fentanyl, which has been blamed for soaring numbers of overdose deaths.

Democrats control both houses of the Vermont legislature.

Marijuana is illegal under federal law. White House spokesman Sean Spicer said in February that federal anti-marijuana laws might be ramped up.