It is illegal to traffic marijuana or smoke it in public in Spain, but people are allowed to grow plants for personal consumption and may even share the herb in private groups.
This tolerance of shared consumption has given rise to so-called cannabis clubs, many in the north and in Barcelona, which has been called the "Amsterdam of southern Europe".
The Supreme Court decision on Wednesday was the first time the court had ruled on the subject of marijuana collectives. The court said that the club in Bilbao had committed a crime against public health because the group’s "structure and functioning exceeded the philosophy" of shared consumption.
The Bilbao organization had been operating as a cooperative with 290 partners and had been producing a large amount of cannabis, thus going beyond the concept of shared consumption, according to newspaper El Pais.
Court sources told the newspaper that the ruling may not necessarily apply to other cannabis clubs because of the Bilbao group’s specific structure, but lower court judges have asked in the past for clarification on the clubs, meaning the ruling will have some influence.
The Supreme Court did say on Wednesday that it felt the debate about the legality of such clubs "for now remains settled" with the ruling.
The prosecution had also accused the Bilbao club of being a criminal group, but the court rejected this charge.
The court said that because there had been confusion about whether smoking clubs are legal, this would lessen the sentence against those running the Bilbao club, and that their sentence would help "determine updates to the doctrine of shared consumption".
Spain has a higher number of marijuana smokers than tobacco smokers and also has one of the highest rates of youth marijuana use in Europe. A poll last December showed that more than half of all Spaniards wanted cannabis to be fully legalized.