May 14 (Reuters) - FedEx Corp lost a motion to dismiss charges by the U.S. Justice Department of conspiracy to distribute controlled substances in connection with the package delivery company's alleged role in transporting illegal prescription drugs.

U.S. District Judge Charles Breyer, however, ruled in favor of the company on a motion to subpoena some communication records. The company has said these would prove it aided law enforcement.

A FedEx official said that while the company accepted the court rulings, it is innocent of the charges.

"We will continue to defend against this indictment, which is an attack on the integrity of FedEx," FedEx Senior Vice President, Marketing & Communications Patrick Fitzgerald said in an e-mailed statement.

FedEx was first indicted in July for shipping packages from illegal online pharmacies despite repeated warnings from U.S. drug enforcement officials.

In August, a new indictment was filed in court alleging FedEx accepted payment from several pharmacies when it knew the revenue came from invalid prescriptions.

Senior company managers were repeatedly warned that online pharmacies that had been the subject of criminal prosecutions for supplying drugs without prescriptions were using its services, the indictment alleges.

Instead of stopping the conduct, FedEx devised policies so it could continue, according to the filing.

The case in U.S. District Court, Northern District of California is United States of America vs. FedEx Corp et al, 14-cr-380.

(Reporting by Kanika Sikka in Bengaluru; Editing by Alan Crosby)