Cannabis in Mexico is legal for both recreational and medicinal purposes. It became legal for recreational purposes in June 2021, upon application and issuance of a permit from the health secretariat, COFEPRIS (Comisión Federal para la Protección contra Riesgos Sanitarios). On 29 June 2021, the Supreme Court of Mexico decriminalized the recreational use of cannabis. President Andrés Manuel López Obrador signed a bill that allows adults 18 and over to possess up to 28 grams of cannabis and grow up to six marijuana plants on their property. 
 The Supreme Court of Mexico first declared the law prohibiting its use unconstitutional on October 31, 2018.  The effect of the ruling is that the Congress of Mexico was ordered to formally legalize cannabis within a period of 90 days. However, the Mexican Congress did not abide and the Supreme Court has often extended the deadline.
 Cannabis had previously been illegal since 1920, personal possession of small amounts was decriminalized in 2009, and medical use of THC content less than one percent was legalized in 2017.
 On March 10, 2021, the Chamber of Deputies passed a bill legalizing recreational marijuana, which was expected to go before the Senate by April 30, 2021. If the bill had been approved, the bill would have gone before the President of Mexico in order to be signed into law.
 After the April 30, 2021 deadline, there was a 10-day period for the Senate to ask the Supreme Court of Mexico for a time extension.  However, before the deadline expired, some lawmakers decided to seek a special legislative session after the June elections.  On June 10, 2021, the Supreme Court decided to list the ¨declaration of unconstitutionality¨ on its docket for a vote on June 28.  The Court voted to legalize adult use of marijuana in an 8-3 decision. 
 Cannabis was introduced to Mexico by the Spanish as early as the 16th century, in the form of hemp. Spain encouraged the production of hemp in the territory, which was used to produce rope and textiles. Following the Mexican War of Independence (1810–1821), hemp farming decreased as subsidies from Spain evaporated.
 Some academics also believe that indigenous Mexicans adopted psychoactive cannabis as the drug Pipiltzintzintli for ritual purposes and divination. By 1898, cannabis use was prevalent in Mexico. The drug was commonly used for recreational purposes and as a folk remedy to treat pain—particularly among military personnel and the lower class.
 In 1882, cannabis was banned at the military hospital in Mexico City, to prevent violence and disorder. Stories of users committing violent crimes were widely circulated by newspapers in Mexico and border towns of the United States. In 1920, Mexico banned the production, sale, and recreational use of cannabis. In 1927, Mexico banned the export of cannabis.
 During the late 1970s, a controversial program sponsored by the US government sprayed paraquat on cannabis fields in Mexico. Following Mexican efforts to eradicate cannabis and poppy fields in 1975, the United States government helped by sending helicopters and other technological assistance. Helicopters were used to spray the herbicides paraquat and 2,4-D on the fields; cannabis contaminated with these substances began to show up in US markets, leading to debate about the program.
 On 21 August 2009, Mexico decriminalized the possession of small amounts of cannabis and other drugs in order to reduce the illicit drug activity. Maximum amounts which could be considered "personal use" were established. Under the new law, anyone caught with up to five grams of cannabis will be advised to seek a drug rehabilitation center rather than arrested or fined. President Felipe Calderon claimed the change would allow law enforcement to focus on major traffickers rather than minor consumers. In practice, minor drug possession was already widely tolerated by police.
 In November 2015, the Supreme Court ruled that four individuals from the Mexican Society for Responsible and Tolerant Personal Use (SMART) would be permitted to grow and consume their own cannabis. The court voted 4–1 that prohibiting people from growing the drug for personal consumption was unconstitutional as it violated the human right to the free development of one's personality.
 In June 2017, President Enrique Peña Nieto signed a bill into law to allow the medical use of cannabis products containing less than one percent THC.  The bill passed the Senate by a 98–7 vote in December 2016 and the Lower House of Congress by a 371–19 vote in April 2017.
 On October 31, 2018, the Supreme Court ruled that the law prohibiting recreational use of cannabis in Mexico was unconstitutional.  As this was the fifth time that the court had ruled in such a way, it set a binding precedent across the country's court system.  The effect of the ruling was that the law prohibiting cannabis still remained in effect, but that it should no longer be enforced due to the fact that anyone could cite the ruling and demand that their charges be thrown out.  The ruling mandated that the government of Mexico move to formally legalize cannabis within the next 90 days. On April 17 2020, the Supreme Court extended the deadline to December 15, 2020.
 On March 10, 2021, the lower house of the Mexican Congress approved a bill legalizing recreational cannabis, in a 316-to-219 vote. The legislation had been expected to pass through the Senate before being sent to President Andrés Manuel López Obrador, who has signaled support for legalization, however the legislation was not completed before the end of the legislative session and the Legislature did not ask for an extension. Some lawmakers floated the idea of a special session after the June, 2021 elections. On June 10, 2021, the Supreme Court listed the ¨declaration of unconstitutionality¨ on their docket for a vote on June 28. 
 On June 28, 2021, the Supreme Court voted 8–3 to legalize adult use marijuana under Mexican law.  However, state and federal penal laws remain in place, pending action by the Mexican Congress to clean up inconsistencies and remove penal language. No legal structure has been put into place allowing for legal sale of marijuana, nor are there provisions for commercial growth and production. Meanwhile, those incarcerated for sale or possession have no path to release. All these await legislative action to bring Mexico's laws into alignment with the Supreme Court rulings. Unlike in the US, a Supreme Court ruling does not automatically invalidate all existing laws. Congress has had years to act, but has not yet done so successfully.
 In 2008, only about 7 percent of Mexico's citizens were in favor of legalizing cannabis. That number grew to about 33 percent in favor of legalizing recreational use in 2016. This was due to the fact that the war on drugs in Mexico has claimed thousands of lives and destroyed families. The recent legislation of cannabis in the United States could be a factor in making Mexico rethink its views on cannabis. One factor against the regulation of cannabis use in Mexico can be because the majority of Mexico's citizens identify as Catholic. The Catholic Church is against the use of cannabis when used for recreational purposes.  Pope Francis said that decriminalizing the drug does not solve the addiction problem.