Legislation aimed at bolstering contracts involving legal marijuana-related businesses has been signed into law by Gov. Jerry Brown.

AB 1159 clarifies that cannabis contracts that comply with state and local law can be enforced so long as they carry a disclaimer that marijuana remains illegal under federal law. Medical marijuana has been legal in California since 1996. But the legality of contracts involving dispensaries, growers and related businesses has often been challenged in state courts.

San Francisco solo J. David Nick said that when he represented defendants in marijuana litigation “the first thing I would do is move to dismiss the complaint because it was an illegal contract under federal law. It would work about half the time.”

When Nick sued on behalf of plaintiffs, “I would crouch in a foxhole,” hoping his complaint would survive any similar challenge, he said. Nick called the new legislation “solid.”

“This is one of the important little parts of the law that needs to be fixed” before California issues its first recreational marijuana licenses in January, he said.

The California legislation also clarifies that the attorney-client privilege remains intact when marijuana business owners seek counsel, so long as they are warned about potential conflicts with federal law.

The legislation is an attempt by some in the legal community to address vexing questions about their practice.

“Protection of the attorney-client privilege while transitioning clients from an unregulated marketplace to a regulated marketplace is going to be imperative to providing strong and professional legal services,” Brendan Hallinan of San Francisco’s Hallinan and Hallinan told a legislative policy committee this summer.

Regional bar associations in San Francisco and Los Angeles have said lawyers may represent clients in the marijuana industry without violating ethical duties. Proposed amendments to the state’s Rules of Professional Conduct would also clarify that attorneys can offer counsel on medical and recreational-use marijuana laws as long as they highlight the conflict between state and federal laws. Those rules changes, and others, are awaiting action by the California Supreme Court.

In related legislative action, Brown vetoed a bill that would have prohibited edible cannabis manufacturers from selling products in potentially kid-friendly shapes, such as animals and fruits. Brown said in a veto message that the bill, AB 350, would have conflicted with legislation enacted this year giving state regulators broad authority to establish rules on cannabis sales, testing and packaging.

Last month, Brown vetoed similar legislation that would have outlawed cannabis labeling and packaging deemed too attractive to minors. He cited his preference for allowing licensing authorities to handle the issue.