If the Democrats win Congress, defense spending will almost certainly tumble.

The more a prospective blue wave erodes Republican majorities in Congress in midterm elections, the greater the pain is likely to be for military contractors who profited handsomely from the "Trump bump" in U.S. stock markets.

A Democratic takeover of the House of Representatives could lead to shares in publicly traded weapons-makers falling by 2 percent, predicted Robert Spingarn, a New York-based analyst with Credit Suisse. If the party wins both chambers, the slide could widen to 3 percent or more.

While the immediate impact would be limited by the considerable growth in the 2018 and 2019 federal budgets, a "Democratic takeover could be a net negative for the medium-term growth story in defense, and perhaps more importantly, for sentiment in the market," Spingarn noted in a report.

Democrats, while willing to spend heavily on defense at times of crisis, can be less supportive when trying to fund other priorities, he noted. And Rep. Adam Smith, the Washington Democrat likely to become chairman of the House Armed Services Committee in a Democratic takeover, has already said defense spending is too high.

[Also read: Bernie Sanders pours cold water on blue wave]

“We are not in a fiscal position to have the size of defense budget that a lot of people envision when they start spinning out all of these nightmare scenarios about everything that we have to be prepared for,” Smith said in September. “Our country has priorities, we have got a debt, we have got a deficit, we have infrastructure problems, we’ve got health care, education. There is a whole lot that is necessary to make our country safe, secure and prosperous."

Democrats would consider defense within that broader picture "and then try to figure out how to fund it," Smith added.

His party will likely have a chance to put Smith's philosophy to work in the House, according to tracking by the Cook Political Report and polling averages compiled by Real Clear Politics. The Senate is a different matter; Real Clear Politics data as of Tuesday gave the GOP good odds of picking up two seats in that chamber.

"Anxiety about the makeup of the next Congress and the likelihood of a spending dip amid blockbuster deficits and a ballooning debt" is understandable, said Roman Schweizer, an analyst with Cowen Washington Research Group, which has tracked federal policy for the past four decades.

In the meantime, however, contractors including Boeing and Lockheed Martin, which have both won lucrative deals to build fighter jets for the U.S. military, are taking advantage of a two-year agreement ratified by lawmakers in March that raised the cap for defense spending to $700 billion for fiscal 2018, which ended Sept. 30, and to $716 billion for 2019.

Since Trump's surprise victory in the 2016 presidential election, such companies have benefited even more from bets that a Republican-led U.S. government would benefit business than other industries. While the widely-followed S&P 500 has gained 29 percent over the intervening two years, Northrop Grumman, Lockheed, and Raytheon have climbed 33 percent or more.

Stock in Chicago-based Boeing, which won more than $13 billion in government contracts over a one-month period this fall, has more than doubled to $354.63.

The question going forward, Schweizer said, is post-election leverage. "A Democrat-led House will be able to push a Republican-led Senate to increase non-defense spending on par with defense," he said.

The stock market reaction to the Nov. 6 vote will be one of the first indicators of how investors expect that dynamic to play out in the two years before the next presidential election. Credit Suisse based its analysis of the outcome on a review of the past 18 federal elections, focusing on those in which party control of one or both houses of Congress shifted.

When Democrats took back both houses in 2006, the companies lost 0.4 percent of their market value. That drop might have been worse but for the fact that the U.S. was involved in two wars at the time and former President George W. Bush retained control he had been by given by Congress over war-related costs.

More relevant to today's political landscape, however, is the mid-term election in 1986, when Democrats -- who already held the House -- took back the Senate, Spingarn said. Defense stocks, which had benefited from the Reagan administration's military buildup to counter the nuclear threat posed by the Soviet Union -- tumbled 1.8 percent in the aftermath.

Similarly, today's defense-spending growth has been driven by Trump's push to upgrade military capabilities that waned amid budget disputes with Congress during the Obama administration, an effort driven partly by the need to counter "a resurgent Russia and a rising China," he said.

"This spending is exclusively under Congressional control," Spingarn added. "As such, further increases in Department of Defense budgets will hinge on accommodative representatives and senators being there to appropriate the money."

Consequently, if the GOP keeps its majorities, defense stocks may climb 3 percent or more, he suggested. In 1994, when Republicans took control of Congress during the second half of then-President Bill Clinton's first term, the shares rose 1.4 percent.