The TSA is allowing you to bring weed on planes — but there’s a catch.The agency updated its policy at the end of last month so passengers can bring medical marijuana stowed in their carry-on or checked luggage, according to the TSA website.

The change comes after the Trump administration declassified marijuana from a Schedule I drug to a Schedule III drug, acknowledging marijuana’s medicinal uses and allowing federal medical research on the drug.

Cannabis for medical use is legal in 40 states and the District of Columbia.

In New Jersey, cannabis is legal not only for medicinal use but also for recreational use by people 21 and older, according to the state’s Cannabis Regulatory Commission.

However, if you are traveling with large amounts of the substance or are not traveling with a valid prescription, you might need to rethink bringing your stash on the plane with you.

Can I bring my recreational weed on through TSA?

The TSA said in a statement their “screening procedures are focused on security and are designed to detect potential threats to aviation and passengers.”

“Accordingly, TSA security officers do not search for illegal drugs, but if any illegal substance or evidence of criminal activity is discovered during security screening, TSA will refer the matter to a law enforcement officer.” the agency added.

However, you are not completely out of the woods if a TSA agent flags you for bringing recreational weed through security.

“If TSA happens to find marijuana in a passenger’s bag, it is required by law to notify local law enforcement, which depending on the state, can land a person in real trouble,” according to the Marijuana Policy Project.