The typically conservative Senate Majority Leader Mitch McConnell is applauding a somewhat surprising provision in the latest 807-page farm bill -- a measure that legalizes hemp.

Industrial hemp is a different variety of the same plant that produces marijuana, so it's been illegal under federal law except for some commercial uses. The Hemp Farming Act, which is part of the farm bill, would remove hemp from its status as a schedule I drug.

McConnell has been an advocate for legalizing hemp so it can be a bigger agriculture product in the U.S., especially in his home state of Kentucky.

A hemp pilot program in Kentucky led to scuffles between state and federal authorities a few years ago, according to the Associated Press. But McConnell says the state brought in $16 million in hemp product sales last year.

Hemp could be a lucrative replacement for tobacco in Kentucky and other states and could provide an alternative for farmers looking to switch from commodities that are struggling or impacted by tariffs.

McConnell even signed the compromise version of the farm bill with a pen made of hemp grown in Kentucky, according to his statement.

The farm bill process has been more contentious than usual over the past year. The typically bipartisan bill is renewed every five years, but the process was delayed beyond a September deadline after House Republicans pushed for proposals to drastically change food assistance programs and last-minute forestry provisions in reaction to the California wildfires.

The process was also under scrutiny because of the economic strain that has affected farmers' amid President Donald Trump's trade wars. The compromise version of the bill dropped some of the most contentious elements and leaders of the House and Senate agriculture committees have said they expect it to pass. The bill contains a wide variety of programs and provides billions of dollars in funding for aid to farmers and nutrition programs like food stamps.

Brady Cobb, a hemp and cannabis lobbyist who has been working with McConnell's office and CEO of the cannabis company SOL Global, said there was a huge campaign to educate members of Congress on how hemp is different from marijuana.

Under the farm bill products containing cannabis byproducts, such as cannabanoid oil, must be below 0.3 percent THC, the active ingredient that causes the effects of marijuana. Such low levels don't have the same effect as recreational or other forms of marijuana, which would still be subject to state laws. State and tribal governments would be charged with regulating and testing industrial hemp under the new law.

Hemp oil can have positive benefits for people suffering from anxiety, epilepsy or even post-traumatic stress disorder and Cobb said veterans' and health groups have also been pushing to legalize it.

"To me this is a springboard, this is a big moment in our country's drug policy history that you now have cannabis hemp plants removed from schedule I so they can be harvested as an agricultural commodity as part of a farm bill," he told ABC News.

Legalizing industrial hemp will make it available to farmers to grow, sell, and export. It will also make it easier for researchers to study the affects of hemp oil products and possibly for health care providers to promote it as an alternative to opioids, Cobb said.

There will be some questions to sort out if the farm bill passes and legalizes hemp. The Food and Drug Administration approved a drug to treat seizures that includes hemp oil earlier this year but may now have to determine whether newly legal products should be regulated as drugs or supplements.

"I see a day when this is sold in Target, this is sold in Costco across a multitude of distribution channels," he told ABC News. "And it has the ability to do that because its not going to be federally illegal anymore, the 800-pound gorilla is going to exit stage left."

The farm bill passed the Senate on Tuesday night by a vote of 87-13. It still needs a vote in the House and the president's signature to become law.