HARTFORD (Reuters) — The Connecticut Senate passed a bill on Saturday legalizing the use of marijuana for medical purposes, with tight restrictions intended to avoid the problems that have plagued some of the other states where it is now legal.

After nearly 10 hours of debate, the Senate voted 21 to 13 in favor of the measure, which has already cleared the House.

Gov. Dannel P. Malloy, a Democrat, is expected to sign the bill. Once he does, Connecticut will join 16 other states and the District of Columbia in allowing the medical use of marijuana.

Connecticut’s legislation calls for tight regulation and seeks to avoid disagreements with the federal government.