The Thai legislature approved its final reading of the amendment to the country's drug law in a 166-0 vote, with 13 abstentions, The Associated Press reported.
The amendment legalizes for medical purposes the production, import, export, possession and use of marijuana, as well as a locally grown plant called kratom that is used as a stimulant and painkiller.
The new law goes into effect when it is published in the Royal Gazette, according to the AP.
Under the law, sellers, growers and researchers will need licenses to handle the drugs and users will need prescriptions.
Recreational use of marijuana and kratom is still illegal and subject to prison terms and fines, the AP added.