Lisa Smith from White Stone, Va., hugs her daughter, Haley Smith, 14, at a 2015 hearing on a medical marijuana bill. A new but related bill passed a Senate committee Monday. (Bob Brown/AP)

RICHMOND — A bill meant to make it easier for Virginians with severe forms of epilepsy to obtain therapeutic oils made from marijuana got a last-minute reprieve Monday from a Senate panel.

The bill seemed in danger of dying in a Senate committee, where it had lingered for about a week. But on Monday, one day before the deadline for legislation to clear one chamber and cross to the other, the bill received and survived a critical vote in a hastily called meeting of the Senate Courts of Justice Committee.

The action drew tears from some parents with epileptic children, who said they have been struggling to obtain the oils.

The oils are sold legally in Colorado but makers there are wary of shipping it across state lines because doing so violates federal law. The parents also risk prosecution for travelling to Colorado and transporting the oils themselves. And they would have to make frequent trips in any case because the oils have a short, 30-day shelf life,

“I have to be very creative and risk a lot,” said Beth Collins of Fairfax, Va. who had traveled to Richmond to press lawmakers on the legislation.

[Northern Virginia families move to Colorado for medical marijuana]

Mark Obenshain (R-Rockingham), chairman of the committee, warned senators before the vote that passage would bring Virginia “one step closer” to legalizing marijuana.

“This is certainly going to help some folks, but next year we’re going to have a request by somebody to make provisions for people to grow pot,” he said.

Some of the Senate’s most conservative Republicans joined with Democrats to advance the bill. Only one other Republican, Sen. Bryce Reeves (Spotsylvania), joined Obenshain to vote against it. Another, Majority Leader Thomas K. Norment (James City), abstained.

“God bless you guys. You’re awesome,” Sen. Thomas Garrett (R-Buckingham), told Collins and Lisa Smith, of White Stone, Va., who had brought her epileptic daughter, Haley, to watch the vote from her wheelchair.

Last year, the General Assembly passed a law intended to make it easier for people with severe forms of epilepsy to use two oils derived from marijuana, which lack the plant’s intoxicating properties but help alleviate debilitating seizures. The bill provided a way for epileptics or their legal guardians to avoid prosecution for possession of cannabidiol oil (also known as CBD) and THC-A oil.

Passage came as something of a surprise in a legislature that has remained staunchly opposed to legalization of marijuana, but the measure was so narrowly tailored that conservative members were largely on board.

Virginia legalized medical marijuana in 1979 for patients with cancer and glaucoma, but that law requires “a valid prescription” — something doctors cannot legally provide as long as marijuana is federally restricted.

[Va. House approves marijuana oils for epilepsy]

Marijuana-oil bills began sweeping though legislatures — many of them in conservative states — after an August 2013 CNN documentary “Weed” that showed the plight of a family seeking the oil for their daughter’s seizures.

The law passed in Virginia last year was intended to prevent patients or their caretakers from being prosecuted for possession of the oils, but it stopped short of making the oils legal. And it did not provide a way for patients to obtain the oils — a flaw in the eyes of critics on the left and right, who said at the time that would force the use of products purchased on the black market whose quality will be uncertain.

But the original bill laid the groundwork for possibly producing the oils in Virginia after 2017, when and if the legislature votes to re-enact it. The law says that no pharmaceutical processor could produce the oils without first obtaining a permit from the state Board of Pharmacy.

The current bill, which still faces a vote in the full Senate and House, would direct the board to start to develop those regulations. Sen. David W. Marsden (D-Fairfax), who sponsored the measure, said he does not want to wait until the measure is reenacted next year because the regulatory process takes as long as 280 days.