A department directive, expected to take effect next week, resolves the conflict in veterans facilities between federal law, which outlaws marijuana, and the 14 states that allow medicinal use of the drug, effectively deferring to the states.

The policy will not permit department doctors to prescribe marijuana. But it will address the concern of many patients who use the drug that they could lose access to their prescription pain medication if caught.

Under department rules, veterans can be denied pain medications if they are found to be using illegal drugs. Until now, the department had no written exception for medical marijuana.

“When states start legalizing marijuana we are put in a bit of a unique position because as a federal agency, we are beholden to federal law,” said Dr. Robert Jesse, the principal deputy under secretary for health in the veterans department.

At the same time, Dr. Jesse said, “We didn’t want patients who were legally using marijuana to be administratively denied access to pain management programs.”

The new, written policy applies only to veterans using medical marijuana in states where it is legal. Doctors may still modify a veteran’s treatment plan if the veteran is using marijuana, or decide not to prescribe pain medicine altogether if there is a risk of a drug interaction. But that decision will be made on a case-by-case basis, not as blanket policy, Dr. Jesse said.

Though veterans of the Vietnam War were the first group to use marijuana widely for medical purposes, the population of veterans using it now spans generations, said Michael Krawitz, executive director of Veterans for Medical Marijuana Access, which worked with the department on formulating a policy.

Veterans, some of whom have been at the forefront of the medical marijuana movement, praised the department’s decision. They say cannabis helps soothe physical and psychological pain and can alleviate the side effects of some treatments.

“By creating a directive on medical marijuana, the V.A. ensures that throughout its vast hospital network, it will be well understood that legal medical marijuana use will not be the basis for the denial of services,” Mr. Krawitz said.

Although the Obama administration has not embraced medical marijuana, last October, in a policy shift, the Justice Department announced that it would not prosecute people who used or distributed it in states where it was legal.

Laura Sweeney, a spokeswoman for the Justice Department, would not comment spefically on the veterans department policy. “What we have said in the past, and what we have said for a while, is that we are going to focus our federal resources on large scale drug traffickers,” she said. “We are not going to focus on individual cancer patients or something of the like.”

Many clinicians already prescribe pain medication to veterans who use medical marijuana, as there was no rule explicitly prohibiting them from doing so, despite the federal marijuana laws.

Advocates of medical marijuana use say that in the past, the patchwork of veterans hospitals and clinics around the country were sometimes unclear how to deal with veterans who needed pain medications and were legally using medical marijuana. The department’s emphasis on keeping patients off illegal drugs and from abusing their medication “gave many practitioners the feeling that they are supposed to police marijuana out of the system,” Mr. Krawitz said.

“Many medical-marijuana-using veterans have just abandoned the V.A. hospital system completely for this reason,” he said, “and others that stay in the system feel that they are not able to trust that their doctor will be working in their best interests.”

In rare cases, veterans have been told that they need to stop using marijuana, even if it is legal, or risk losing their prescription medicine, Mr. Krawitz said.

David Fox, 58, an Army veteran from Pompey’s Pillar, Mont., uses medical marijuana legally to help quiet the pain he experiences from neuropathy, a nerve disorder. But he said he was told this year by a doctor at a veterans’ clinic in Billings that if he did not stop using marijuana, he would no longer get the pain medication he was also prescribed.

A letter written to Mr. Fox in April from Robin Korogi, the director of the veterans health care system in Montana, explained that the department did not want to prescribe pain medicine in combination with marijuana because there was no evidence that marijuana worked for noncancer patients and because the combination was unsafe.

“In those states where medical marijuana is legal, the patient will need to make a choice as to which medication they choose to use for their chronic pain,” Ms. Korogi wrote. “However, it is not medically appropriate to expect that a V.A. physician will prescribe narcotics while the patient is taking marijuana.”

Mr. Fox was shocked by the decision, he said.

“I felt literally abandoned,” he said. “I still needed my pain meds. I thought they were supposed to treat you. It was devastating for me.”

Mr. Fox, who said that at one point he was weaning himself off his pain medication for fear of running out, has held one-man protests in front of the clinic, carrying signs that read “Abandoned by V.A., Refused Treatment.”

This month, Dr. Robert A. Petzel, the under secretary for health for the veterans department, sent a letter to Mr. Krawitz laying out the department’s policy. If a veteran obtains and uses medical marijuana in accordance with state law, Dr. Petzel wrote, he should not be precluded from receiving opioids for pain management at a veterans facility.

Dr. Petzel also said that pain management agreements between clinicians and patients, which are used as guidelines for courses of treatment, “should draw a clear distinction between the use of illegal drugs, and legal medical marijuana.”

Dr. Jesse, the veterans department official, said that formalizing rules on medical marijuana would eliminate any future confusion and keep patients from being squeezed between state and federal law.

Steve Fox, director of government relations for the Marijuana Policy Project, which favors the legal regulation of the drug, called the decision historic. “We now have a branch of the federal government accepting marijuana as a legal medicine,” he said.

But Mr. Fox said he wished the policy had been extended to veterans who lived in states where medical marijuana was not legal.

He said it was critical that the veterans department make its guidelines clear to patients and medical staff members, something officials said they planned on doing in coming weeks.

Said Dr. Jesse, “The whole goal of issuing a national policy is to make sure we have uniformity across the system.”

James Dao contributed reporting.

A version of this article appears in print on July 24, 2010, on page A1 of the New York edition with the headline: V.A. Easing Rules for Patients Who Use Medical Marijuana. Order Reprints|Today's Paper|Subscribe