WASHINGTON  People who use marijuana for medical purposes and those who distribute it to them should not face federal prosecution, provided they act according to state law, the Justice Department said Monday in a directive with far-reaching political and legal implications.

In a memorandum to federal prosecutors in the 14 states that make some allowance for the use of marijuana for medical purposes, the department said that it was committed to the “efficient and rational use” of its resources and that prosecuting patients and distributors who are in “clear and unambiguous compliance” with state laws did not meet that standard.

The new stance was hardly an enthusiastic embrace of medical marijuana, or the laws that allow it in some states, but signaled clearly that the administration thought there were more important priorities for prosecutors.

“It will not be a priority to use federal resources to prosecute patients with serious illnesses or their caregivers who are complying with state laws on medical marijuana,” Attorney General Eric H. Holder Jr. said in a statement accompanying the memo, “but we will not tolerate drug traffickers who hide behind claims of compliance with state law to mask activities that are clearly illegal.”