A lawsuit filed by FedEx against the U.S. government over export rules follows a dispute over diverted shipments that were intended for Huawei Technologies, the Chinese telecommunications-equipment giant.

The lawsuit challenges changes to export rules designed to keep technology out of the hands of entities or people that the U.S. government considers potential risks to national security.

In May, the U.S. government added Huawei to a list of entities and people barred from receiving U.S. technology without a special license from the Commerce Department. Shortly after that, Huawei complained about FedEx diverting several company shipments.

FedEx apologized to Huawei for the missed deliveries, which it said were accidental. However, China announced that it was investigating FedEx over the matter.

The delivery company complains that the rules “essentially deputize FedEx to police the contents of the millions of packages it ships daily even though doing so is a virtually impossible task.”

FedEx Corp. sued the Commerce Department and Commerce Secretary Wilbur Ross in federal district court in Washington on Monday. It asked the court to block the government from enforcing export controls against it.

The Commerce Department said in a statement that it has not reviewed the complaint but looks forward to “defending our role in protecting U.S. national security.”

FedEx Chairman and CEO Fred Smith said the lawsuit was broader than “the Huawei issue … which was three packages out of 15 million packages a day.”

“The Huawei packages were only peripherally involved in this lawsuit that we filed, and in fact it goes back many, many years,” Smith said Tuesday on a conference call to discuss the company’s quarterly results with analysts. He said the final straw was Friday, when the Commerce Department added five more entities covered by the same rules.

On Sunday, the Huawei dispute flared again when the Chinese company complained on Twitter about FedEx blocking shipment of a Huawei phone from the United Kingdom to the U.S. Smith called it a mistake by a junior employee.

“We are expected to be policemen for these export and import controls, and there are about 1,100 entities now on this list,” Smith told Fox News. If the company makes a mistake on any shipment, he said, it can be fined $250,000 per piece without having a trial or due process of law.

In its lawsuit, FedEx said most packages are sealed when customers drop them off, making it impossible for the company to know the contents. FedEx said it compares names and addresses of shippers and recipients against the government’s watch list of restricted groups and people.

FedEx wants a so-called safe harbor — a provision that would protect it from being penalized if it didn’t know that a particular shipment would violate the export rules.

Meanwhile, tension between the U.S. and China over trade, tariffs and the export rules continues to rise. Huawei filed a lawsuit in federal court in Texas to challenge the constitutionality of a law that bars the government and its contractors from using Huawei equipment.

FedEx has run afoul of export controls before. Last year, the company agreed to pay $500,000 to settle government allegations that it violated the rules with some shipments to flagged entities in France and Pakistan.

Memphis, Tennessee-based FedEx released its latest financial results Tuesday reflecting weakness in its core express business. The company also indicated its profit in the coming year would be squeezed by slower global economic growth and a move to drop an Amazon delivery contract.

FedEx shares were down for a second straight day. They lost $4.92, or 3.1%, to close at $155.98 on Tuesday after falling 2.7% on Monday.

© The Associated Press. All rights reserved.