DOVER — By a 21-15 vote, with five abstentions, the House defeated legislation Wednesday that sought to make Delaware the 10th state with legal marijuana.

Although the measure garnered a majority, it needed 25 votes because of a provision creating new fees.

The vote was just one step in the process for the bill, which would still have had to pass the Senate, but its failure guarantees the First State will not have recreational weed in 2018.

The outcome left supporters disappointed but still clinging to hope.

“It’s not a matter of if, it’s a matter of when,” main sponsor Rep. Helene Keeley, D-Wilmington, said afterward, drawing an analogy to gay rights, a cause that built up momentum — slowly, at first — until it became reality.

The vote left her and a few others with tears in their eyes. Zoe Patchell, president of the Delaware Cannabis Advocacy Network, lamented the bill would have passed if a simple majority was required.

Rep. Jeff Spiegelman, of Clayton, was the only Republican to back the bill. Five Democrats abstained, while the rest voted in favor.

The proposal has attracted substantial interest from the public, and supporters have attempted to mobilize to convince lawmakers to back the measure. Some of the most prominent advocates have been a regular sight in Legislative Hall, lobbying in an effort to see passage before the General Assembly concludes business for the year.

Because Rep. Keeley is not running for reelection, she wanted to have a vote ahead of Saturday, the last regularly scheduled legislative day. She said afterward she knew before the vote the numbers were not there but wanted to run the bill in recognition of the strong support from advocates.

Opposition from law enforcement, she opined, was the primary cause of the bill’s defeat.

House Bill 110 would have allowed individuals at least 21 years of age to buy cannabis from special shops. Use in public and in cars would have remained illegal, as would growing marijuana, and businesses would have been able to set restrictions around marijuana use by employees.

The state’s medical marijuana program would not have been impacted by the bill.

Rep. Keeley estimated the legislation would have generated at least $30 million, with that money being split between education efforts, police training, substance abuse initiatives and the state’s General Fund.

The bill was filed in March of 2017 and released from committee about six weeks later, but it stalled in the House for more than a year. While backers worked to gather the necessary votes, they were hindered by the fact the measure initially required a supermajority of 28 votes, seven more than a simple majority.

Hoping to gain support, Rep. Keeley and cosponsor Sen. Margaret Rose Henry, D-Wilmington, formed a task force that held eight meetings over the course of six months looking at issues around legalization.

However, several members were resolutely opposed to legalization, and the task force was marred by confusion in the final two meetings. An initial vote to release the panel’s report was declared to have succeeded, only for it to then be pointed out the total was actually one vote shy of passing.

A subsequent meeting was scheduled, and the report was eventually released, although several members harshly criticized the task force and declared it had failed to fulfill its purpose.

Wednesday, representatives debated the bill for about 50 minutes as a handful of Delawareans watched intently from the balcony, with a few filming on their phones in hopes of a historic moment. On the House floor, some representatives wore gold lapel pins in the shape of marijuana leaves.

Supporters defeated two amendments and approved three more, lowering the required vote total from 28 to 25, but it wasn’t enough.

Opponents argued legalization would lead to more impaired driving, would not reduce the black market and would result in more substance-exposed babies being born.

“We appreciate the thoughtful consideration of this issue by members of the General Assembly,” Cathy Rossi, vice president of public and government affairs for AAA Mid-Atlantic, one of the lead opponents of the bill, said in a statement. “We believe the final vote reflects the necessary caution before any major public policy change.

“As legislators in Illinois, Vermont, New Hampshire, and Connecticut decided in recent months, recreational marijuana is a complex issue that deserves significant scrutiny. From a road safety perspective, we want Delaware drivers, passengers, bicyclists, and pedestrians spared the increased risk of marijuana-impaired drivers that states like Colorado and Washington are now facing.”

Gov. John Carney, a Democrat, does not support legalization.

Marijuana remains illegal at the federal level, and while the Obama administration adopted a hands-off policy, the U.S. Department of Justice rescinded that decision earlier this year.

Delaware legalized medical marijuana in 2011 and decriminalized possession of cannabis in 2015, with Rep. Keeley helping drive both efforts.

Backers said the bill would help put an end to the War on Drugs and allow people to use a substance many view as no more harmful than alcohol.

“We have already gone 60 percent of the way toward marijuana,” Rep. Sean Lynn, D-Dover, said.

According to a 2016 poll from the University of Delaware, 61 percent of Delaware voters back legalization — numbers supporters said are only going to grow.

“Once you understand that, the only logical conclusion that you can come to is this bill should be passed tonight,” Rep. Trey Paradee, D-Cheswold, said. “If you’re against this bill or you’re on the fence, keep in mind you’re against the majority of your constituents.”