WASHINGTON (AP) — President Donald Trump’s acting attorney general on Thursday signed an order reclassifying state-licensed medical marijuana as a less-dangerous drug, a major policy shift long sought by advocates who said cannabis should never have been treated like heroin by the federal government.

The order signed by Todd Blanche does not legalize marijuana for medical or recreational use under U.S. law. But it does change the way it’s regulated, shifting licensed medical marijuana from Schedule I — reserved for drugs without medical use and with high potential for abuse — to the less strictly regulated Schedule III. It also gives licensed medical marijuana operators a major tax break and eases some barriers to researching cannabis.

Trump told his administration in December to work as quickly as possible to reclassify marijuana. On Saturday, as the Republican president signed an unrelated executive order about psychedelics, he seemed to express frustration that it was taking so long.

Blanche said Thursday that the Department of Justice was “delivering on President Trump’s promise” to expand Americans’ access to medical treatment options. “This rescheduling action allows for research on the safety and efficacy of this substance, ultimately providing patients with better care and doctors with more reliable information,” he said in a statement.

Blanche’s action largely legitimizes medical marijuana programs in the 40 states that have adopted them. It sets up an expedited system for state-licensed medical marijuana producers and distributors to register with the U.S. Drug Enforcement Administration.

It makes clear that cannabis researchers won’t be penalized for obtaining state-licensed marijuana or marijuana-derived products for use in their work, and it grants state-licensed medical marijuana companies a windfall by allowing them, for the first time, to deduct business expenses on their federal taxes.

The regulation of medical marijuana has come a long way since California became the first state to adopt it in 1996, Blanche wrote.

“Today the vast majority of States maintain comprehensive licensing frameworks governing cultivation, processing, distribution, and dispensing of marijuana for medical purposes,” Blanche wrote. “Taken as a whole, they demonstrate a sustained capacity to achieve the public-interest objectives ... including protecting public health and safety and preventing the diversion of controlled substances into illicit channels.”

However, marijuana or marijuana-derived products that are not distributed through a state medical marijuana program will continue to be classified in Schedule I.

Many Republicans oppose loosening marijuana restrictions, with more than 20 Republican senators signing a letter last year urging the president to retain the current standards. As Trump emphasizes his administration's war on drugs, particularly fentanyl, he maintains a complex stance on cannabis, balancing the new regulations with existing prohibitionist standards.