Just over two decades ago, California became the first state to legalize and regulate medical marijuana. Since then, the nationwide trend has almost without exception been toward loosening prohibitions on the drug, particularly in light of increasing evidence that supports its therapeutic use in treatment of a range of ailments. All told, 28 state currently authorize cannabis for medical treatment.

Now South Carolina has a chance to enact its own sensible medical cannabis laws, and state lawmakers should seize the opportunity.

A bipartisan group of legislators, led by Sen. Tom Davis, R-Beaufort, recently unveiled the S.C. Compassionate Care Act. The detailed legislation provides a framework for regulating marijuana cultivation, sale, prescription and consumption by patients with “debilitating conditions.”

It’s not the first time South Carolina has floated a bill to legalize medical pot. Last year, a similar effort died in committee after state law enforcement officials came out against it.

And a 2014 law permitted the use of oil derived from cannabis that is used to treat seizures, although conflicting provisions in other S.C. laws have made it difficult for patients to find and purchase that treatment in the state.

That’s a major flaw in a potentially lifesaving piece of legislation. But the non-psychoactive cannabidiol oil legalized in 2014 is far from the only cannabis-derived product capable of providing valuable, scientifically sound medical treatment.

The S.C. Compassionate Care Act cites in its introduction a 1999 Institute of Medicine report demonstrating marijuana’s effectiveness in treating a variety of ailments, including providing relief from chronic pain and a reduced reliance on opioid painkillers.

That is a particularly crucial potential benefit of legal medical cannabis given the state’s troublingly high number of opioid painkiller prescriptions and the climbing number of fatal overdoses. Marijuana would unquestionably be a safer alternative.

But various studies have shown it can also help patients cope with side effects from cancer medications, with complications resulting from AIDS, with glaucoma, neurological disorders, anorexia, autoimmune diseases and severe nausea, among myriad other conditions.

Simply put, cannabis has recognized medical uses, and doctors and patients in South Carolina deserve the option to have it medically prescribed to alleviate specific ailments.

South Carolinians overwhelmingly agree. A Winthrop Poll conducted last October found that a whopping 78 percent of S.C. residents support legal medical marijuana. That number is simply too large to ignore.

Broadly, the S.C. Compassionate Care Act would create a licensing process to allow patients access to medical marijuana with the express permission of their long-term medical care providers.

It also establishes guidelines and regulations for marijuana cultivation, production, quality and safety testing, distribution and dispensation, all under the oversight of the state Department of Health and Environmental Control.

The bill’s sponsors describe it as a “seed to sale” program that would establish a real-time tracking system to monitor cannabis at every step from farm to patient. Multiple measures would help prevent medical cannabis from finding its way into unauthorized hands.

And use of marijuana by unlicensed people, as well as impaired driving, smoking in public places and other potentially objectionable uses would remain prohibited.

Local governments could also pass ordinances and regulations related to medical marijuana so long as they don’t constitute an outright ban.

Of course, state lawmakers must take care when considering such a potentially impactful piece of legislation, and the advice and opinions of law enforcement officials merit serious review.

But it’s time that South Carolina join a majority of other states in adopting a more reasonable stance on an accepted medical treatment.

The state should legalize medical marijuana.