The U.S. Court of Appeals for the Federal Circuit ruled that most of President Donald Trump’s so-called reciprocal tariffs on global trading partners are illegal, upholding an earlier ruling by the Court of International Trade, which found that the tariffs’ legal basis under the International Emergency Economic Powers Act wasn’t valid.President Donald Trump’s trade war suffered a severe blow late Friday, when a federal appeals court stuck down most of his so-called reciprocal tariffs against global trading partners.The U.S. Court of Appeals for the Federal Circuit upheld an earlier ruling by the Court of International Trade, which found that the tariffs’ legal basis under the International Emergency Economic Powers Act (IEEPA) wasn’t valid, saying that the administration’s argument for the tariffs didn’t constitute an emergency.The 7-4 ruling won’t take effect until Oct. 14, as the court sought to give the Trump administration time to appeal to the Supreme Court. The decision also doesn’t cover sectoral tariffs, such as those on aluminum and steel, that were imposed under a separate legal basis.But Trump’s “Liberation Day” tariffs—which shocked global markets on April 2 and triggered a massive selloff—helped leverage a series of trade deals. That includes an agreement with the European Union, which pledged to invest $600 billion in the U.S. and buy $750 billion worth of U.S. energy products, with “vast amounts” of American weapons in the mix. Similarly, the U.S.-Japan trade deal entails $550 billion in investments from Tokyo.Meanwhile, the reciprocal and sectoral tariffs are expected to generate $300 billion-$400 billion a year, a huge revenue windfall that was seen propping up the fiscal outlook.Last week, the Congressional Budget Office estimated that tariffs would shave trillions of dollars off the federal budget deficit. Meanwhile, S&P Global reaffirmed its AA+ credit rating and stable outlook on U.S. debt last week owing in part to “robust tariff income,” which should help offset the impact of tax cuts and spending in the federal budget. This story was originally featured on Fortune.com