(Reuters) - Washington Governor Jay Inslee on Friday signed a bill that will overhaul the state's medical marijuana market, reconciling the long unregulated system with the voter-approved recreational pot industry.

While marijuana remains illegal under federal law, voters in Washington state and Colorado approved recreational cannabis use in landmark votes in 2012 that ushered in licensed and taxed retail stores offering a range of products to adults.

But in Washington state, a loosely regulated medical marijuana industry has run alongside the recreational-use system.

"Until today, our system has been completely unregulated," Inslee said in a statement. "Today, after tremendous hard work and compromise by legislators on both sides of the aisle, I signed a bill that will create a medical marijuana system that works for Washington."

The bill will remove collective gardens that supply medical dispensaries starting next year, in favor of four-person "cooperatives."

Some existing collectives will be allowed to continue operating however, if granted a license on the basis of factors such as the applicant's tax history.

It will also establish a voluntary database of medical patients and let authorized patients possess three times the amount of marijuana allowed by the recreational-use law.

In addition, the bill will let state-licensed pot retailers obtain a medical marijuana endorsement to sell products.

Opponents have criticized the measure as the equivalent of a sick person having to get medicine in a liquor store, saying regulators were already "overtasked" in managing commercial pot, while patients feared higher retail prices and more difficult access.

Many unanswered questions remain however, such as the number of dispensaries to survive under the bill and how actively police would clamp down on shops violating the law.

"While this bill takes a tremendous step forward, we still have much to do on medical marijuana, tax policy, enforcement, local revenue sharing and funding for public health prevention programs," Inslee said in the statement.

(Reporting by Curtis Skinner in San Francisco; Editing by Michael Perry)