ANNAPOLIS, Md. — Finalists seeking licenses to grow medical marijuana in the state can defend their interests in a legal challenge over how they were chosen, Maryland’s highest court ruled Friday.

The Court of Appeals reversed a lower court ruling that barred the finalists from involvement in the case.

“We are gratified by the decision of the Court of Appeals granting our clients the right to defend themselves and their considerable investments,” said Arnold Weiner, who represented the growers who are finalists to be licensed.

Alternative Medicine Maryland, an applicant not chosen as a finalist, alleges in a lawsuit that the Maryland Medical Cannabis Commission didn’t consider the racial diversity of the applicants as required under the law. Lawyers for the company are asking Baltimore Circuit Court Judge Barry Williams to block the commission from awarding any more licenses until the lawsuit is resolved.

So far, the state commission has only awarded one final license. ForwardGro, which is based in Stevensville, received the first license to grow marijuana in May. Maryland law allows 15 medical marijuana growers.

Attorneys for the companies asked the court to allow them to intervene in the lawsuit say the companies have invested tens of millions of dollars in their companies.

Some growers have been hoping to make marijuana available for patients by the end of the summer, after a rollout that has been delayed by setbacks for more than four years.

The state approved its first medical marijuana law in 2013. The effort stalled, however, because it required academic medical centers to run the programs, and none stepped forward. The law was changed in 2014 to allow doctors certified by a state commission to recommend marijuana for patients with debilitating, chronic or severe illnesses.