Green Thumb Industries security head Terry Gainer, former Senate sergeant at arms and Capitol Police Chief, at the site of a proposed medical marijuana growing operation in Hagerstown, Md., in 2015.

A company that lost its bid to grow medical marijuana in Maryland has filed a lawsuit alleging that regulators illegally rejected its application in favor of lower-ranked businesses from underrepresented parts of the state.

It’s the first legal challenge to the medical cannabis program, which has been embroiled in various controversies and remains in the early stages of making the drug available to patients more than three years after lawmakers first legalized its medical use.

In August, the Maryland Medical Cannabis Commission awarded 15 preliminary licenses to grow marijuana based on applications scored and ranked by outside evaluators. Regulators rejected two higher-ranked companies in favor of authorizing growing operations in Prince George’s and Worcester counties.

[Last minute change in who can grow medical pot spurs complaints]

Green Thumb Industries-Maryland, one of the companies bumped out of the top 15, filed suit Monday in Baltimore City Circuit Court. The lawsuit calls the reshuffling illegal and arbitrary, saying the commission told applicants that location “is not relevant” for preliminary licensing and later reversed course.

Josh Genderson, a licensed grower of medical marijuana in Washington, DC, won a preliminary license to grow in Prince George’s county even though he didn’t have one of the highest-ranking growing applications because regulators wanted more geographic diversity. That move is now the subject of a lawsuit. (Photo by Linda Davidson / The Washington Post)

Green Thumb Industries is asking the court to compel the commission to award it a preliminary license, which it says is worth tens of millions of dollars.

A spokeswoman for the attorney general’s office, which provides legal counsel to the commission, says her office does not comment on pending litigation.

Regulators have defended its reshuffling of applicants, citing language in the medical marijuana legalization law that requires commissioners to “actively seek to achieve” geographic diversity in cultivation sites. Had the commission licensed the 15 highest ranked growers, there would have been no cultivators in the southern Eastern Shore and none south of Anne Arundel County on the west side of the Chesapeake Bay.

[Here’s who wants to grow medical pot in Maryland]

“This was an agonizing decision, but that was really the only fair way that we could come up with,” Buddy Robshaw, the vice chair of the commission, told The Washington Post last month.

Applicants who were not awarded licenses criticized how the commission went about deciding geographic diversity and questioned why the commission didn’t simply ask the highest-ranking applicants to grow in underrepresented areas.

Robshaw previously told The Post that asking businesses to relocate their operations would have violated the double-blind nature of the application process where the identities of applicants were kept secret.

The lawsuit filed by Green Thumb Industries alleges that two companies approved to process cannabis into medical products were contacted by the commission and given an opportunity to relocate. It says the commission did not reach out to GTI with a similar chance to move.

[From top cop to pot farm guard: Terry Gainer’s new gig]

Green Thumb Industries-Maryland is a local offshoot of a Chicago-based company with affiliates that have licenses to grow and dispense marijuana in Illinois, Massachusetts and Nevada. It was the lowest-ranking of three companies that sought to grow in rural Washington County.

Team members include security director Terrance W. Gainer, a former U.S. Capitol Police chief and U.S. Senate Sergeant Arms, and investor Eugene Monroe, a former lineman for the Baltimore Ravens who has been the foremost advocate of medical marijuana for NFL players.