Medical marijuana was supposed to make life easier for people with chronic pain, cancer, Alzheimer’s disease, glaucoma, and other conditions.

And it has, as long as you live in a state where medical marijuana is legal… and you stay there.

But if you decide to leave your state — or the United States — you could end up facing a dizzying array of legal consequences.

These range from being asked to dump your weed at the airport, to having to deal with local law enforcement, to getting a prison sentence (in certain countries with a hardline stance against marijuana).

For Charlotte Caldwell, a 50-year-old woman from Castlederg, Northern Ireland, it also meant losing the six-month supply of cannabis oil she had picked up in Toronto to treat her son’s severe epilepsy.

Medical marijuana is illegal in the United Kingdom, except for one cannabis-based product.

When Caldwell declared the cannabis oil to border officials at Heathrow Airport in London, they confiscated the supply, reports The Telegraph.

After outcry over this and similar cases, the British government announced this week that it would take steps to lift its ban on cannabis-based medicines, according to the AP News.

But for Americans, traveling with medical marijuana, either on an international or a domestic trip, can still be tricky.

Traveling with marijuana still risky

Twenty-nine U.S. states have medical marijuana laws, reports the Marijuana Policy Project.

That means there are 21 states where you aren’t legally allowed to use marijuana, even with a prescription from a doctor.

Complicating matters, marijuana is illegal under federal law. It’s classified as a Schedule 1 drug, which puts it in the same category as heroin and “bath salts.”

Donna Shields, a registered dietitian and co-founder of the Holistic Cannabis Academy, said that any time you travel outside your state with marijuana — whether it’s by plane, train, or bicycle — you’re transporting a federally restricted substance across state lines.

This leaves you “vulnerable.”

“People sometimes think transporting marijuana from one legalized state to another — California to Washington, for example — makes it OK, but it’s not,” said Shields. “It’s the act of crossing the border that makes it illegal. Plain and simple.”

Because of the disconnect between federal and state marijuana laws, trying to board a plane in the United States while carrying medical marijuana puts you in a legal gray zone.

Some airports in states that have legalized recreational marijuana don’t have policies prohibiting marijuana on the premises, reports The Boston Globe. This includes Logan International Airport in Boston and LAX in Los Angeles.

But Denver International Airport in weed-friendly Colorado forbids having marijuana on airport property.

When you reach the security checkpoints, though, you’re entering federal territory.

The Transportation Security Administration’s screening procedures are governed by federal law. The TSA lists medical marijuana as a prohibited item. This includes cannabis-infused products, such as cannabidiol (CBD) oil.

Some airports in states that have legalized recreational marijuana have “amnesty boxes” where travelers can ditch their weed before passing through security.

Although marijuana is illegal under federal law, TSA’s focus is on identifying terrorism and security threats to aircraft and passengers, said spokesperson Lorie Dankers.

But if screeners find marijuana on a traveler or in their luggage, they will handle it the same as other illegal items.

“As has always been the case, if during the security screening process a TSA officer discovers an item that may violate the law, TSA refers the matter to law enforcement,” said Dankers.

TSA’s response is the same in every state and at every airport. It also doesn’t differentiate between recreational and medical marijuana.

TSA bumps weed cases to local police

What local law enforcement does depends on which airport you’re at.

According to the Globe, if TSA agents at Logan call in the Massachusetts State Police, the state trooper would decide if you’re legally allowed by state law to possess the marijuana.

If you aren’t breaking the law, they’ll let you go. You may be asked to dispose of your weed before going through security… or maybe not.

A TSA spokesperson told the Globe that if a state police officer determined that the marijuana was legal, TSA personnel would be “unlikely” to keep someone from boarding their plane.

But even if you make it through security, American Airlines and other airlines don’t allow passengers to transport marijuana on their flights.

And if you’re headed to a state where medical marijuana isn’t legal, you’re subject to prosecution if local law enforcement finds your pot.

The situation can be even more serious when traveling to other countries.

In the United Arab Emirates, carrying even small amounts of marijuana can lead to four years in jail, reports the High Times. In Japan, which has a zero-tolerance policy when it comes to marijuana, you could get at least five years in jail.

If you really feel like you need the medical marijuana at your destination, do your research before leaving home.

This means knowing the local laws, what documentation you need from your doctor, and where you can buy medical marijuana — it’s safer to buy there than travel with it.

The bottom line, though, is that traveling with medical marijuana anywhere it isn’t legal is risky.

“It’s totally possible that you could transport the product without any legal repercussions,” said Shields, “but you should know there’s an inherent risk, so determine your tolerance for this type of risk.”