BANGKOK — In a region known for its harsh penalties for illegal drugs, Thailand is set to become the first nation in Southeast Asia to allow the use of marijuana for medical purposes.

Thailand’s military government, which has called elections for the end of February, has backed medical usage, which must be approved by the nation’s monarch, King Maha Vajiralongkorn.

By a vote of 166 to 0, the military-appointed National Legislative Assembly approved legislation this week that would allow the use of cannabis under medical supervision. Thirteen members abstained.

The measure is expected to take effect next year.

“This is a New Year’s gift from the National Legislative Assembly to the government and the Thai people,” the lawmaker who headed the drafting committee, Somchai Sawangkarn, said during a televised session on Tuesday.