BANGKOK — After a years-long struggle and multiple hold-ups, a proposal to legalize marijuana for medical use passed the last legal hurdle required Tuesday and is on its way to become the law of the land.

In a unanimous vote of 166-0, the interim parliament approved the amendment of narcotics laws to permit the use of cannabis for medical treatment and research in its third and final session deliberating the bill. Thirteen lawmakers abstained.

Those permitted to possess marijuana under the new bill include researchers, Red Cross officials, traditional Thai practitioners, local farmers approved by the state, operators of transnational transportation and foreign patients who require medical marijuana for their treatment.

Bill sponsor Somchai Sawangkan thanked parliament after the meeting and said he considers the amendment a New Year’s present to all Thais.

The law also calls for a designation of areas where kratom could be consumed, medically and recreationally, without legal repercussion, and areas where marijuana can be cultivated under supervision of the Narcotics Control Board.

And there’s also amnesty for individuals who already currently possess cannabis intended for medical use, given that they register the substances with the Food and Drug Administration within 90 days after the law is enacted.

Unsanctioned possession of marijuana will remain illegal, punishable by up to five years in prison. The sentence goes up to 15 years for possession of over 10 kilograms.

It is not yet clear when the law will come into effect, but legislation is typically enacted within a month after the parliament approves it.

While medical cannabis advocates and activists will surely celebrate the news, one proponent of the bill voiced concern at the parliament’s decision.

Panthep Phuaphongphan, a medicine professor at Rangsit University, wrote online that the amendment might end up causing legal confusion because officials have not yet clearly answered whether foreign pharmaceuticals were permitted to patent certain strains of Thai cannabis.

Foreign pharma have made a quiet push to seize control of the yet-nascent industry through patent applications filed before the law passed.