Linda Horan set out to buy medicine, not make history.

But the 64-year-old cancer patient did make history Friday as she became the first New Hampshire resident to legally purchase medical marijuana under a law approved more than two years ago. After a court battle, Horan was granted a certification card that allows her to buy medical cannabis in Maine because no dispensaries have opened in New Hampshire.

“My God, I’m over the moon. Completely over the moon,” Horan said while sitting in a consultation room at the Wellness Connection dispensary in Portland, her patient certification card in her hands and her medical marijuana arrayed on a table in front of her. “I knew this day would come because I have complete confidence in my team. Now that it’s actually here, I’m completely overwhelmed.”

Horan, who has end-stage lung cancer, won a lawsuit last month that allowed her to become certified as a medical marijuana patient so she could buy marijuana in Maine. New Hampshire lawmakers approved the use of medical marijuana more than two years ago, but the first four dispensaries are not expected to open until sometime next year.

Horan, who says she may be dead by the time the dispensaries open, sued the state to get an identification card that would allow her to purchase medical marijuana in Maine, where there are eight dispensaries and more than 2,200 caregivers are authorized to sell marijuana. Lawyers for the state argued that issuing Horan a card would undermine New Hampshire’s need to control distribution, but a judge ordered the state to process Horan’s application and issue a card to the Alstead resident if it was approved.

“It’s a historic day in New England,” said Rep. Renny Cushing, a Democrat from Hampton who supported Horan’s fight for access and who was with her at the dispensary Friday. “I was shocked it got to the point that Linda had to sue and that the state then put up such a fight.”

New Hampshire Attorney General Joseph Foster on Thursday advised New Hampshire’s Department of Health and Human Services to start issuing medical marijuana ID cards to eligible patients. The department has received more than 70 applications for ID cards.

Maine’s medical marijuana law allows a qualifying patient from another state to buy marijuana in Maine as long as the patient has a valid medical marijuana certification from their home state.

The practice of moving to a state that allows medical marijuana is not unheard of, especially among families that use a low-THC strain of medical cannabis called Charlotte’s Web to treat pediatric seizure disorders. More than 100 families moved to Colorado in 2014 so they could access medical marijuana, including at least one Maine family that wasn’t able to find a low-THC form of marijuana here, according to the Realm of Caring, a nonprofit that advocates for medical marijuana patients.

In order to buy medical marijuana at a Maine dispensary, an out-of-state patient must provide their home-state certification, a Maine certification printed on tamper-proof paper and a photo ID, said Marietta D’Agostino, program manager for the Maine Medical Marijuana Program.

“The visiting qualifying patient must meet all of the terms of Maine statute and that includes the list of qualifying conditions,” D’Agostino said in an email. “The law was intended to serve those patients in Maine for a vacation or a school term and was not intended to allow people to drive up for the day to purchase medical marijuana and then drive home.”

The number of out-of-state patients who have obtained a Maine certification was not immediately available Friday from the Department of Health and Human Services.

Horan’s case generated intense media interest. On Friday, a half-dozen reporters traveled from New Hampshire to interview Horan at the dispensary.

Because Horan is now a certified patient in New Hampshire, she will not face prosecution for possessing the marijuana she buys in Maine. Horan was diagnosed in July with lung cancer that grew rapidly and has since spread to her lymph nodes and brain. Her doctors have told her marijuana could help reduce nausea and minimize the need to control pain with narcotics.

Horan, whose voice at times sounds weak, says she has wasting syndrome and now weighs 90 pounds. She hopes the marijuana will help stimulate her appetite, ease anxiety and allow her to stay away from opioid pain killers. On Friday, she purchased four different types of marijuana to smoke, lemon and mint chocolate cookies, cannabis pills and a tincture she can put in food or under her tongue. She said she was “like a kid in a candy store.”

“The fact that this will stimulate my appetite and prevent me from disappearing into a bag of bones, I’m very happy about that,” she said.

Horan also was happy to hear of the attorney general’s directive for DHHS to start issuing certification cards to qualifying patients.

“Originally when we wanted to do this, it wasn’t just for me. It was for every qualifying patient in the state,” she said. “The clock is ticking for me. I don’t have that much time. The fact that Maine has made itself available to me is something I can never say thank you for enough.”

Becky DeKeuster, director of education for Wellness Connection, said Horan’s situation demonstrates the strength of Maine’s medical marijuana program. DeKeuster doesn’t know the exact number of out-of-state patients who buy medical cannabis from Wellness Connection’s four dispensaries, but characterized it as a “handful” of their 11,000 patients.

“We’re fortunate to be in a state that has successfully implemented these rules and policies to allow patients from other states to buy medicine in Maine,” she said. “It’s so important because we have to remember, in our efforts to create regulations and build this industry in a responsible manner, that at the bottom it is all about patients like Linda. We need to balance bureaucracy with compassion.”