HARRISBURG, Pa. (Reuters) - Pennsylvania was poised to become the 24th U.S. state to legalize marijuana use for medical purposes after state legislators on Wednesday approved a bill that Democratic Governor Tom Wolf has promised to sign.

The bill will allow use of marijuana oil and extracts, while still prohibiting the smoking of the drug, to treat or alleviate the symptoms of a long list of ailments including autism, epileptic seizures and nausea brought on by chemotherapy.

The bill, which passed by a 149-46 vote in the state House of Representatives, sets up an infrastructure for growing, distributing, regulating and taxing medical marijuana.

Statewide opinion polls consistently show that 88 percent or more of Pennsylvanians support medical marijuana. That reflects a 50-year national trend toward general acceptance of marijuana, especially among younger and more liberal Americans.

"Marijuana is medicine and it's coming to Pennsylvania," state Senator Daylin Leach, a Democrat from the Philadelphia suburbs who was one of two prime sponsors of the bill, said following the vote. "Children with intractable epilepsy, veterans with PTSD, grandparents with cancer, and thousands of other sick Pennsylvanians will finally get the help they need."

The other prime sponsor, state Senator Mike Folmer, a Republican from Lebanon, has said on his website that his own experience as a cancer patient led him to believe patients "should have every opportunity to combat their illness," including use of medical marijuana.

The Pennsylvania Senate passed the Folmer-Leach bill last year, but it stalled in the House because of vehement opposition from Republican House Speaker Mike Turzai. A spokesman for Leach credited House Majority Leader Dave Reed, also a Republican, with easing the bill around the speaker's opposition.

The state's first medical marijuana bill was introduced by former Representative Allen Kukovich, a Democrat from the Pittsburgh suburbs, in 1979. He said Wednesday that he was inspired by early research showing the drug benefited patients with extreme seizure disorder, as many as 100 seizures per day.

"It never moved," Kukovich said in an interview. "It got no support from the leadership in either party. Marijuana was being demonized then."

Four U.S. states, Colorado, Washington, Oregon and Alaska, as well as the District of Columbia, in the past few years have legalized recreational marijuana use through ballot initiatives. Voters in five more states are to vote on legalization in November. The drug remains illegal under federal law.

(Editing by Scott Malone and Fiona Ortiz)