Washington (CNN) President Donald Trump's announcement that the US will impose tariffs on steel and aluminum will not only impact the US domestic economy, but also the Pentagon, potentially raising costs and straining vital military partnerships overseas.

While US and international stock markets slid and foreign leaders warned of a trade war creating higher prices and unemployment, Trump trumpeted on Twitter Thursday that "trade wars are good, and easy to win!"

The longer term implications for the Pentagon might not be so easy to manage. They include potentially higher costs for weapons systems including the F-35 and other advanced aircraft. It could also trigger retaliation against US defense and aerospace industries that in turn, would raise costs for the US military.

Perhaps most significantly, tariffs and a trade war would put a deep strain on alliances the Pentagon relies on for missions that are vital to US national security in Europe, the Middle East and Afghanistan.

"DOD continues to be concerned about the negative impact on our key allies regarding the recommended options within the reports," Defense Secretary James Mattis wrote in a memo to the Commerce Department supporting the idea of the tariffs last month.

Mattis agreed with Commerce Secretary Wilbur Ross' assessment that "the systematic use of unfair trade practices to intentionally erode our innovation and manufacturing industrial base poses a risk to our national security."

Ross had suggested a blanket tariff on all global steel imports, a worldwide quota limiting how much steel countries could import, and a third option of only targeting 12 countries with the tariffs -- an approach that Mattis said was preferable and should be further refined.

He suggested incentives so that allies would work with the US on addressing Chinese abuses, instead of being alienated by the move: "It is critical that we reinforce to our key allies that these actions are focused on correcting Chinese overproduction and countering their attempts to circumvent existing anti-dumping tariffs -- not the bilateral US relationship."

Close US allies are on the list of countries that could be hit by the tariffs. Canada, for example, is not only a NATO partner that has worked with the US to counter ISIS and Russian aggression in Ukraine, but it is also the largest exporter of aluminum to the US for defense industrial purposes.

"The first risk really isn't with China, it's with our allies," said James Lewis, a senior fellow at the Center for Strategic and International Studies. "One of the strengths of US security is that we have allies and China and Russia don't, so alienating the Germans, the Mexicans, the Canadians, the Japanese does not help us or our national security."

Other allies that could be potential targets include the Netherlands, the UK, France and South Korea. Many of them could be less likely to be willing to bear the costs on large missions like the counter-ISIS coalition, or NATO if they are paying higher costs elsewhere, said Andrew Hunter, director of the Defense Industrial Initiatives Group at the Center for Strategic and International Studies.

South Korea is trying to manage the delicate issue of talks with North Korea, while some US officials threaten pre-emptive strikes against Pyongyang if it threatens the US with its nuclear and missile program.

It could also "make those countries a little less willing to join us on diplomatic endeavors, by which I mean sanctions," Hunter said.

There are direct costs related to steel tariffs. Mattis noted in his memo that the US military uses only about 3% of US domestic production of steel and that there would be no impact on the "ability of DOD programs to acquire the steel or aluminum necessary to meet national defense requirements."

But as tariffs take effect, the price of domestic steel and aluminum would rise, pushing up the Pentagon's costs for building and construction. Steel is a large component in the manufacture of aircraft carriers and combat tanks, and aluminum is a big component in the F-35 and other advanced aircraft.

There are potentially indirect costs for the Pentagon tied to the tariffs, most likely if foreign governments retaliate by slowing or cancelling purchases from the US defense and aerospace industry.

Hunter points out the longer term risk to close military to military relationships. When allies buy US military equipment, he said, "a lot of what they're buying is a relationship with the US military, and obviously if they do less of that, there's a lessening of those relationships as well."

A drop in foreign military sales, which account for anywhere between 20% and 35% of sales for US defense contractors, indirectly contributes to higher Pentagon costs as weapons manufacturers transfer more of their overhead costs to the Defense Department when their revenues fall, Hunter said.

Retaliation could be less direct, said William Reinsch, a former head of the National Foreign Trade Council. If China decides to interrupt supply chains in the telecom and IT sector, that could hurt many US industries as well as the military.

"Modern day warfare is heavy on" technology, said Reinsch, "so it's significant. Another obvious example is rare earths, which are a major ingredient in a lot of things, iPhones, semi-conductor chips."

And then there's the prospect of more activity. Reinsch foresees the possibility that China could react by conducting more provocative activity in contested areas in Asia, and perhaps complicating US efforts to deal with North Korea.

"I would look for a heightened level of activity in the South China Sea and the East China Sea," Reinsch said. The US has treaty obligations to come to Japan's defense if a territorial confrontation between Tokyo and Beijing flares out of control. "I can see them deciding that it's appropriate to cause trouble for us with allies," he said, adding that, "I think that it's a given that it will" complicate any cooperation with China to deal with Pyongyang.