SEATTLE — Legislation aimed at bringing Washington State’s largely unregulated medical marijuana system under state control, which state officials have said is crucial to maintaining order as the legalized sale of recreational marijuana begins this year, died late Thursday night without a vote as the House and Senate adjourned.

“I’m taken aback,” said Gov. Jay Inslee, a Democrat, after the Legislature concluded its regular session for the year with the legislation still on the calendar. “Many people at the last moment apparently did not want a bill.”

Many medical marijuana dispensaries and patients had opposed the new regulations, fearing that their system could be crushed by the commercial market and intrusive government oversight. But sponsors and supporters said the regulations would protect patients by giving them greater assurance of access to the medicinal strains they want, and by possibly reducing the risk of federal prosecution. The United States Justice Department has said it will allow a legal marijuana marketplace, approved by voters here and in Colorado in 2012, only if is it tightly regulated by the states.

Ultimately, however, the bill, a version of which has passed in the Senate, died in the House in a fight over taxes. Some lawmakers, led by Republicans, wanted to amend the bill to distribute more of the anticipated revenue from marijuana sales from the state to local governments.