Catalonia is drawing up rules to allow the use of marijuana for the treatment of patients suffering from conditions with symptoms such as pain and loss of appetite, the region's health minister Boi Ruiz has said.
The move would open the way for the drug to be prescribed to cancer and AIDS patients, among others.
The plan was partly designed to stop Barcelona's increasingly popular clubs from controlling the supply of medical marijuana, Ruiz said in an interview with Spain's Europa Press news agency.
"Patients shouldn't have to go to cannabis club because I haven't been able to make rules on this subject," the regional health minister said.
Those clubs also shouldn't be able to use medical marijuana as a way of legitimizing their activities, he added.
Catalan authorities have been involved in a running battles with Barcelona's cannabis clubs, numbers of which have soared in recent years.
The presence of the clubs has fuelled a boom in the number of tourists looking for legal highs, despite those clubs technically being private establishments meant for members only.
It is illegal in Spain to traffic cannabis or smoke it in public but private growing and use are allowed. Clubs which are run as not-for-profit cooperatives can use this loophole to grow their own marijuana and provide a venue to smoke it.
Some, however, have been accused of bending the rules by buying cannabis on the black market and enticing tourists to join.
Barcelona recently shut down 49 cannabis clubs for "deficiencies in their functioning and problems of coexistence with neighbours".
In June, the city also announced no new clubs would be able to open in the coming year.
Catalonia began moving towards the legalization of medical marijuana in trials in 2007.