The city of Santa Cruz has asked a federal judge to approve its plan to distribute medical marijuana directly to sick and dying patients through a new Office of Compassionate Use.

The city, along with the American Civil Liberties Union and the advocacy group Drug Policy Alliance, filed a federal complaint Tuesday urging the government to allow the newly created city department to provide the drug to patients.

City officials said they will not distribute marijuana unless Santa Cruz wins the legal battle. Several California cities and counties already have programs to dispense medical marijuana to thousands of registered users.

California law has allowed medical marijuana use since voters approved Proposition 215 in 1996, but the U.S. Supreme Court ruled over the summer that the federal government can continue to prosecute users.

California is one of 12 states where medical marijuana is legal. The court complaint argues that the U.S. Constitution leaves it up to states — not the federal government — to decide whether cities can distribute marijuana to sick patients.