The Friday decision by Superior Court Judge Anthony Mohr could mean a large number of dispensaries could reopen.
It also could lead to new pot dispensaries popping up as the legal wrangling continues.
The judge ruled that Los Angeles improperly extended its moratorium, creating confusion over the deadline for dispensaries to register.
After the L.A. City Council approved the ordinance earlier in 2010, 180 of the dispensaries applied to remain open, but only about 40 met all the criteria.
The ordinance's requirements included having dispensaries be 1,000 feet from schools, parks and other gathering sites and its owners also undergoing a background check.
In granting the ordinance, Mohr said the due process rights of operators of shuttered dispensaries were violated because they weren't provided a hearing to argue against the closure.
The Associated Press contributed to this report.