(AP) SANTA CRUZ City officials in Santa Cruz voted to create a city department to dispense medical marijuana and vowed to fight federal drug regulators in court to win final approval.

The city council voted 4-2 on Tuesday to create the Office of Compassionate Use, a five-member advisory board that would coordinate medical marijuana distribution within the city.

Co-sponsored by Mayor Mike Rotkin, the ordinance will help the city ensure that qualified patients get the drug as local and federal authorities spar over the legality of medical marijuana, officials said.

California law has allowed medical marijuana use since voters approved Proposition 215 in 1996.

But the U.S. Supreme Court ruled this summer that the federal government can continue to prosecute users.

Rotkin said he was approached about the idea by the American Civil Liberties Union and a local cooperative, Wo/Men Alliance for Medical Marijuana, a 200-member group that was raided by federal agents in 2002.

The groups said the ensuing legal fight will be an effective way to test state control over medical marijuana distribution.

"I am excited, and I applaud the city council for its creativity and bold decision to put the issue squarely before the courts in a way that is not reckless," said Allen Hopper, senior staff attorney with the Drug Law Reform Project, an ACLU program.

Rotkin rebutted criticism that the office will cost the cash-strapped city and said user fees will support it. Council members plan to coordinate with local pharmacies such as Walgreens to sell marijuana if the office is approved.