The House of Representatives voted Thursday to allow Veterans Administration doctors to recommend medical marijuana to their patients in states where the treatment is legal.

The Veterans Equal Access Amendment, introduced by Rep. Earl Blumenauer (D-Ore.) and co-sponsored by a bipartisan group of lawmakers, effectively strikes down a Department of Veterans Affairs restriction on its doctors recommending medical marijuana as treatment for veterans experiencing pain, PTSD or other conditions. Under current regulations, veterans had to seek these recommendations outside of the VA system and pay out of pocket for the related expenses.

Medical marijuana is legal in 24 states as well as the District of Columbia.

The House passed the amendment, which is attached to the 2017 military appropriations bill, in a 233-189 vote. Later Thursday, the Senate passed a massive spending bill including similar language on medical marijuana. (The Senate's amendment was approved by the appropriations committee last month.) Pending final passage of the spending bill and approval by the president, the new regulation would go into effect next year.

"I have been deeply troubled about our inability to adequately deal with our returning veterans from Iraq and Afghanistan," Blumenauer said in an interview following the vote, pointing to the high rates of opioid abuse and suicide among veterans. "A lot of them are suffering from PTSD, chronic pain, traumatic brain injury, and these are all conditions that have been shown to respond to medical marijuana."

He continued, "The notion that the VA would not allow its doctors to consult with and work with veterans regarding medical marijuana in states where it's legal I thought was outrageous."

This was Blumenauer's third attempt to end the VA's policy against recommending medical pot. He credited the country's swiftly changing attitudes on marijuana as well as strong bipartisan support for the measure -- 57 Republicans voted in favor of it -- for this year's passage. Looking ahead to addressing issues like marijuana banking and federal funding for cannabis research, Blumenauer predicts that momentum will continue.

"I'm convinced within five years, everybody in America will have access to some form of medical marijuana," he said.

Tom Williams via Getty Images Rep. Earl Blumenauer (D-Ore.) introduced the amendment.

Marijuana advocacy groups praised Thursday's vote as significant progress for veterans.

"We are delighted to lift this outdated, discriminatory policy, which has negatively impacted the lives of so many veterans," said Michael Collins of the Drug Policy Alliance. "We need all options on the table to treat veterans, and finally Congress has seen sense and will allow veterans to be on an equal footing to other residents of medical marijuana states."

"Prohibiting VA doctors from recommending medical marijuana does nothing to help our veterans," said Marijuana Policy Project's Robert Capecchi. "Current VA policy is preventing physicians from thoroughly monitoring patients' medication decisions and engaging in frank conversations about available treatment options. It dramatically undermines the doctor-patient relationship."

In recent years, many veterans have turned to marijuana as an alternative to prescription painkillers or antidepressants. However, the Drug Enforcement Agency classifies all forms of cannabis as Schedule I, the "most dangerous" category of drugs, claiming there's "no currently accepted medical use."

Reclassification may be on the horizon. In April, the DEA said it plans to decide on whether to reschedule marijuana sometime this year. The agency has also approved a study on marijuana's effectiveness as a treatment for PTSD.