The Obama administration on Friday issued guidelines intended to give banks confidence that they will not be punished if they provide services to legitimate marijuana businesses in states that have legalized the medical or recreational use of the drug, even though it remains illicit under federal law.

The guidance, which requires banks to vigorously monitor their marijuana-industry customers, was provided by the Treasury Department and the Justice Department in separate advisories. The policy does not grant immunity from prosecution or civil penalties to banks that serve legal marijuana businesses. But it directs prosecutors and regulators to give priority to cases only where financial institutions have failed to adhere to the guidance.

Still, the banking industry was quick to say that the new guidelines would not be sufficient to make banks feel at ease about opening accounts for or granting loans to marijuana businesses because the drug would still be illegal under the federal Controlled Substances Act.

“While we appreciate the efforts by the Department of Justice and FinCEN, guidance or regulation doesn’t alter the underlying challenge for banks,” Frank Keating, president of the American Bankers Association, said in a statement, referring to the Financial Crimes Enforcement Network, the Treasury unit that issued part of the guidelines. “As it stands, possession or distribution of marijuana violates federal law, and banks that provide support for those activities face the risk of prosecution and assorted sanctions.”