Attorney General Jeff Sessions on Thursday rescinded Obama-era policies that took a largely hands-off approach to enforcing federal marijuana laws in states that have legalized the drug for medical or recreational purposes.

In a single-page memo, Mr. Sessions called the previous guidance “unnecessary” and permitted U.S. attorneys to take a more aggressive approach to enforcing laws on marijuana trafficking and use. Justice Department officials said the previous guidance wasn’t consistent with federal law.

Mr. Sessions was concerned that the guidance had created “a safe harbor for the marijuana industry to operate” in certain states, an official said. The conflict between the federal ban and state laws that permit the drug has long been an anomaly in the legal system, one that has only grown as more states have legalized marijuana.

“It is the mission of the Department of Justice to enforce the laws of the United States, and the previous issuance of guidance undermines the rule of law and the ability of our local, state, tribal and federal law-enforcement partners to carry out this mission,” Mr. Sessions said in a statement.

The move prompted immediate criticism from lawmakers, including Republicans, in states that have legalized marijuana.