The GOP-controlled House voted Wednesday to prevent the federal government from blocking state laws that permit the use of medical marijuana.

But lawmakers narrowly declined to direct the Justice Department not to interfere with states like Colorado and Washington that permit the recreational use of marijuana.

The 242-186 vote on medical pot was a larger margin than a tally last year, when the House first approved it as part of a bill funding the Justice Department. Wednesday's vote was to renew the pro-pot language as part of a bill providing funding for the coming fiscal year.

Most Republicans opposed the idea and the Senate is in GOP hands this year so the outcome could still be reversed. But Senate advocates of Medical marijuana won a test vote in the GOP-controlled Appropriations Committee last month.

On Wednesday, 67 Republicans, including libertarian-minded lawmakers such as Thomas Massie of Kentucky, combined with all but a handful of Democrats in support of states that allow doctors to prescribe pot for medical uses such as improving the appetites of cancer patients undergoing chemotherapy.

Almost half the states allow medical marijuana, which remains an illegal drug under federal law. But the federal government has adopted a hands-off approach to states that have adopted lenient marijuana laws. The Justice Department has issued guidance to governors in such states — including the three that have enacted laws permitting pot possession for recreational use — that it won't challenge those laws so long as marijuana is tightly regulated.

"The medical marijuana train has definitely left the station," said Rep. Earl Blumenauer, D-Ore.

The Treasury Department has also issued guidance intended to clarify that financial institutions can offer services to businesses that dispense marijuana, though industry advocates say most banks are still reluctant to do so for fear of prosecution.

The amendment to allow recreational pot use, offered by conservative Rep. Tom McClintock, R-Calif., was rejected by a surprisingly narrow 222-206 vote. McClintock's measure had less GOP support and more Democratic opposition than did the amendment on medical marijuana.