SAN FRANCISCO — A California Supreme Court committee advised judges in the state Wednesday to stay away from pot — meaning investments in pot businesses.

Maintaining any interest in a business that involves medical or recreational marijuana is incompatible with a judge's obligation to follow the law, the court's Committee on Judicial Ethics Opinions said.

California voters have legalized the use of recreational and medical marijuana, but the drug remains illegal under federal law.

The committee said involvement in a pot business could also cast doubt on a judge's ability to act impartially, particularly in marijuana-related cases.

"There will always be at least an appearance of impropriety and doubts regarding impartiality when a judge decides to disregard a law to benefit his or her personal interest," the committee wrote.

The committee cited judicial ethics rules on marijuana in Maryland, Washington state and Colorado, though none appears to address pot investments.

In Maryland, judicial appointees may not grow, process or dispense medical cannabis. In Washington state, judges cannot allow court employees to have medical marijuana businesses, and in Colorado, judges cannot use marijuana, according to the committee.

The Committee on Judicial Ethics Opinions is made up mostly of judges. Though all its members are appointed by the state Supreme Court, it is considered an independent body.

The pot guidance was issued in response to a request from a judicial officer or a candidate for judicial office.

The committee said judges have an obligation to make reasonable efforts to determine whether any of their financial or property investments involve the sale or manufacturing of marijuana.

Among the investments they should scrutinize are private equity funds, corporate shares and real estate.

Marijuana investments by the spouses of judges are also discouraged to avoid the appearance of impropriety.