A salesman stands at a counter selling mobile phones produced by ZTE at a store in central China. (AP)

INVOKING NATIONAL SECURITY as a rationale for restricting trade can be a tricky business. In general, there are two ways to get it wrong: You can invoke national security when it does not really apply. Or you can remove economic strictures on countries or corporations that actually do threaten U.S. security.

We’ve seen both recently from President Trump. His threat to impose tariffs on steel and aluminum from allies such as Canada and Japan spuriously invoked national security as a pretext. More recently, he overlooked genuine national security concerns with his sudden announcement that he’s reconsidering newly imposed sanctions on ZTE, the partially state-owned Chinese telecommunications company guilty of a systematic, years-long effort to sell its services and equipment to Iran, using U.S.-made inputs, and to North Korea.

The president’s about-face came in the form of an improvised tweet just a month after the Commerce Department barred U.S. firms from selling components to ZTE for seven years, tantamount to a death sentence for this pillar of Chinese state capitalism. Given the Commerce Department security bureau’s findings, based on an extensive U.S. investigation going back to the Obama administration, the punishment fit the crime; indeed, the Trump administration had let ZTE off with a fine and probation in March 2017, only to discover that it continued to lie and cover up its lack of compliance. The company is, a top Commerce official found, “incapable of being, or unwilling to be, a reliable and trustworthy recipient of U.S.-origin goods, software, and technology.”

Mr. Trump, however, said he was moved by the loss of jobs at ZTE plants in China and ordered his secretary of commerce, Wilbur Ross, to come up with an alternative, undoubtedly lighter, punishment for the firm. China reciprocated by relaxing its previous opposition to U.S.-based Qualcomm’s proposed acquisition of semiconductor maker NXP, and by offering to lift its threat of tariffs on U.S. agricultural goods (which were provoked by Mr. Trump’s tariff threats against China to begin with).

This seems rather paltry compensation for a huge U.S. concession, which Mr. Trump made before his trade talks with President Xi Jinping’s government pick up steam. Maybe it was motivated by a higher diplomatic purpose: Mr. Trump’s need to keep Beijing mollified in the run-up to his summit meeting with Beijing ally Kim Jong Un of North Korea — but that’s not what the president said. “This is also reflective of the larger trade deal we are negotiating with China and my personal relationship with President Xi,” he tweeted Monday. That contradicted Mr. Ross’s statement, just three hours earlier, that the U.S. “position has been that [the ZTE ban is] an enforcement action separate from trade.”

This confusion has to end, and not only because it’s sowing uncertainty for business. If the words “national security” mean anything, they define a policy concern that takes precedence over everything else, even jobs or farm exports. U.S. efforts to secure trade objectives or security objectives suffer when policymakers invoke, or disavow, national security goals in an unprincipled or inconsistent manner, cherry-picking provisions of U.S. law to suit their agenda of the moment. So far, unfortunately, that is exactly how the Trump administration has operated.