Proposition 203 won by a tiny margin of just 4,341 votes out of more than 1.67 million votes counted. The measure started out losing by about 7,200 votes on Nov. 2 and the gap gradually narrowed in the following 10 days.
The measure began Friday losing by about 1,500 votes, then surged ahead by 4,421 votes.
Maricopa was the only Arizona county with ballots still outstanding on Saturday. The county finished counting all the remaining provisional and early ballots by late in the afternoon.
The final, unofficial count was 841,346 in favor of the measure and 837,005 opposed.
Marijuana Nation: The New War Over Weed
"Now begins the very hard work of implementing this program in the way it was envisioned, with very high standards," said Andrew Myers, campaign manager for the Arizona Medical Marijuana Policy Project. "We really believe that we have an opportunity to set an example to the rest of the country on what a good medical marijuana program looks like."
Backers of Proposition 203 argued that thousands of patients faced "a terrible choice" of suffering with a serious or even terminal illness or going to the criminal market for pot. They collected more than 252,000 signatures to put the measure on the ballot nearly 100,000 more than required.
The measure will allow patients with diseases including cancer, HIV/AIDS, Hepatitis C and any other "chronic or debilitating" disease that meets guidelines to buy 2½ ounces of marijuana every two weeks or grow plants.
The patients must get a recommendation from their doctor and register with the Arizona Department of Health Services. The law also allows for no more than 124 marijuana dispensaries in the state.
All Arizona's sheriff's and county prosecutors, the governor, attorney general and many other politicians came out against the proposed law.
Carolyn Short, chairwoman of Keep AZ Drug Free, the group that organized opposition to the initiative, said her group believes the proposed law will increase crime around dispensary locations, lead to more people driving while impaired and eventually lead to legalized pot for everyone.
She noted that the major financial backer of the new measure, the Washington-based Marijuana Policy Project, makes no bones about its ultimate goal: national legalization of marijuana for everyone.
"All of the political leaders came out and warned Arizonans that this was going to have very dire effects on a number of levels," Short said after the measure pulled into the lead late on Friday. "I don't think that all Arizonans have heard those dire predictions."
Arizona is the 15th state to approve a medical marijuana law. California was the first in 1996, and 13 other states and Washington, D.C., have since followed suit.
Arizona voters overwhelmingly approved a medical marijuana law in 1996 and 1998, but it never went into effect because of problems with its wording. Then in 2002, voters rejected a sweeping initiative that would have decriminalized possession of up to 2 ounces of marijuana for any user and required state police to hand out the drug to seriously ill people.