California lawmakers are trying to protect the marijuana industry by establishing California as a sanctuary state for pot.

A bill moving through the state legislature would prohibit state and local police from assisting federal agents who target marijuana businesses that are legal according to state law, unless those agents have a court order.

"The reason for this is because the present administration in Washington is very unpredictable," Assemblyman Reggie Jones-Sawyer, a Democrat from Los Angeles and the author of the bill, told CNNMoney. "This is protecting the rights of Californians."

The bill passed the state Assembly 41-33 last week. Most Democrats supported the bill, and most Republicans opposed it.

Brandon Ebeck, a spokesman for Republican Assemblyman Marc Steinorth, who opposed the bill, said he considered it premature, citing a 2014 directive from the Obama administration for the feds to take a hands-off approach to state-legal marijuana businesses.

"We've heard threats from the Trump administration, but so far we haven't seen anything to retract that memorandum," Ebeck said, referring to a

California voters approved recreational marijuana last fall. Sales will become legal Jan. 1. Eight states and the District of Columbia have approved legal recreational pot.

But marijuana remains illegal according to federal law, which equates it with heroin. It is unclear what the Trump administration intends to do about this, or whether it's going to do anything at all.

Attorney General Jeff Sessions has spoken frequently about his distaste for marijuana and legalization. He has said that "good people don't smoke marijuana," a drug he has described as "only slightly less awful than heroin."

"I reject the idea that America will be a better place if marijuana is sold in every corner store," he said in a speech earlier this year.

Related: The CEO of High Times most definitely inhales

Sessions appointed a task force in April to review "existing policies" for marijuana and to "ensure consistency" with the anti-drug policy of the Trump administration. But he hasn't said whether he's going to crack down on the industry in legal states.

Marijuana entrepreneurs in California and others states where cannabis is legal have told CNNMoney that they are nervous about Trump and Sessions, but expect to prevail if the feds come after them.

The sanctuary bill still has to pass the Democratic-controlled Senate before it heads to Governor Jerry Brown, a Democrat. The governor's office did not return messages from CNNMoney to say whether he would sign the bill.

The California Police Chiefs Association and the California State Sheriff's Association told CNNMoney that they also oppose the bill. The Justice Department and the California Highway Patrol declined to comment, and the Drug Enforcement Administration did not return messages from CNNMoney.

California's attempt to protect its marijuana industry from federal intervention is not unique. Colorado lawmakers tried to pass a similar bill, but it failed to get through the Senate.

And Oregon passed a law prohibiting marijuana businesses from collecting personal information from customers, specifically so the feds couldn't get to it, said Mason Tvert, spokesman for the Marijuana Policy Project, a pro-legalization group.

Any federal enforcement could have big repercussions in California, where marijuana sales are expected to top $6.5 billion by 2020, according to New Frontier Data, a company that analyzes the marijuana industry.

Sales totaled $2.8 billion last year, based on medical marijuana sales alone. California legalized medical marijuana in 1996.

Jones-Sawyer, the assemblyman, said he hoped Trump and Sessions would focus their efforts on illegal operations in California. He said there are 135 legal medical dispensaries in Los Angeles, but 1,400 illegal dispensaries.

Related: Marijuana businesses worry about Trump, but expect to prevail

Dispensaries have to adhere to state and local laws governing regarding taxes, zoning, the security of the facility, the sourcing and packaging of the product, and whether the buyer is 21 or older, or has the state-issued ID including a medical card, if the facility is a medical dispensary.

"I would hope before they start shutting down the legal ones, they start shutting down the illegal ones," he said.