BIRMINGHAM, Ala., March 20 (Reuters) - A medical marijuana bill unanimously passed both the Alabama House and Senate on Thursday and is headed to the desk of Gov. Robert Bentley, who has said he will sign it into law.

The measure makes it legal to possess only a prescribed medical grade extract known as CBD or cannabidiol, which is non-intoxicating.

The U.S. Congress in 1972 deemed the oil to have no accepted medical use and banned it.

However, some studies have shown it to be useful in treating a number of conditions, including seizures, and it has been legalized for use in 20 states, according to the Medical Marijuana ProCon website.

Called Carly's Law, the bill in Alabama originated to help control violent seizures suffered by a toddler with a severe neurological disorder.

The girl's family won the backing of Republican state Rep. Mike Ball, sponsor of the bill, and the governor, who has indicated his support.

The bill includes $1 million in funding for a neurology research project into cannabidiol oil at the University of Alabama at Birmingham.

"UAB will undertake research into the mechanisms underlying cannabidiol to learn more about its function and effect on seizures," said David Standaert, chairman of the university's Department of Neurology.

The extract is low in tetrahydrocannabinol, or THC, the psychoactive compound that gives users the feeling of being high. (Editing by Ellen Wulfhorst and Gunna Dickson)