(CNN)South Africa's Constitutional Court approved the private use and cultivation of cannabis Tuesday, which could be a step toward broader legalization.
In a unanimous ruling hailed by activists campaigning for the legalization of marijuana, judges declared unconstitutional three sections of the Constitution that prohibited cannabis consumption, possession and cultivation.
The ruling says Parliament should change the law within 24 months.
Selling and smoking cannabis, popularly known as "dagga" in South Africa, in public places remains illegal.
South Africa joins a growing list of African countries embracing the legal use of marijuana. Last year, Lesotho became the first African country to offer legal licenses to grow it. In April, Zimbabwe's government legalized cultivation for medicinal and scientific purposes.
Cannabis is the most widely used drug in the world, according to the UN's 2018 World Drug Report, which estimates that 3.9% of the global population between the ages of 15 and 64 used it at least once in 2016. The majority of the increases in recent years were in Africa and Asia.
South Africa's Dagga Party won a court case last year permitting cannabis smoking in homes, paving the way for Tuesday's ruling. Jeremy Acton, the party's leader, said it will continue to lobby for legislation that includes the public use of cannabis.
In his view, laws regulating marijuana use should not be stricter than those for tobacco and alcohol use.
"The ruling is a victory for every person who is a member of our culture. However, people should be able to gather in places which are still private events where collective experience of cannabis use may continue, just as people gather to have a beer," Acton said.