MANCHESTER, New Hampshire — Sen. Bernie Sanders has railed against big defense corporations at rallies, but he has a more complex history with the military-industrial complex. Most notably, he’s supported a $1.2 trillion stealth fighter that’s considered by many to be one of the bigger boondoggles in Pentagon history.

Sanders has made his opposition to Hillary Clinton’s hawkishness a cornerstone of his campaign. But he hasn’t exactly been antiwar all his career. When it has come time to choose between defense jobs and a dovish defense policy, Sanders has consistently chosen to stand with the arms-makers rather than the peaceniks—leading to tension with some of the most adamant adherents of progressive ideology.

In 1985, for example, protesters massed at the General Electric plant in Burlington, Vermont, where Sanders was serving as mayor. They were protesting the fact that the plant was manufacturing Gatling guns to fight socialists in Central America.

Jim Condon, now a Democratic state legislator in Vermont, was news director of a local radio station at the time and describes himself as an “old acquaintance” of the senator.

“There were protesters who were unhappy that General Electric was manufacturing Gatling guns at the plant, and so they would lock themselves to the gates and engage in civil disobedience. And so the mayor, Bernie, finally got cops to go in and arrest the protesters,” Condon told The Daily Beast. “The GE plant was one of the largest providers of jobs in the city. So it was economically important that the plant stay open and people who worked there went to work.”

When it comes time to make speeches, Sanders has slammed defense corporations for political gain.

“We know that there is massive fraud going on in the defense industry. Virtually every major defense contractor has either been convicted of fraud or reached a settlement with the government,” Sanders said in Iowa City last year at a town hall. “We need a strong military, it is a dangerous world. But I think we can make judicious cuts.”

But when those defense corporations come to his own backyard, he quietly welcomes them in.

The Vermont senator persuaded Lockheed Martin to place a research center in Burlington, according to Newsweek, and managed to get 18 Lockheed Martin F-35 fighter jets stationed at the city’s airport for the Vermont National Guard.

“In very clever ways, the military-industrial complex puts plants all over the country, so that if people try to cut back on our weapons system what they’re saying is you’re going to be losing jobs in that area,” Sanders said at a Q&A in New Hampshire back in 2014. “[W]e’ve got to have the courage to understand that we cannot afford a lot of wasteful, unnecessary weapons systems, and I hope we can do that.”

History has shown that Sanders has not had the courage to do that.

Immediately after he made those comments, an audience member pointed out that the F-35 fighter jet project had a lifetime cost of $1.2 trillion: “When you talk about cutting wasteful military spending, does that include the F-35 program?” the questioner asked.

The F-35 stealth fighter is untold billions over budget, years behind schedule, and plagued with embarrassing problems. There have been problems with its software, its sensors, and its gun (which won’t be able to fire until 2019). A few months ago a military spokesman said that the fighter jet “wasn’t optimized for dogfighting.” In fact, in a test battle with the 40-year-old F-16, the brand new F-35 jet lost.

“The F-35 will, in my opinion, be 10 years behind legacy fighters,” one Air Force official affiliated with the F-35 program told The Daily Beast about a year ago.

Sanders countered that the plane was “essentially built.” He acknowledged in his 2014 Q&A that while the F-35 was “incredibly wasteful,” it is now the “plane of record… and it is not going to be discarded.”

During his 2012 reelection campaign, Sanders ran against a Republican who opposed the F-35 as a waste of resources. Sanders was all for it. In a 2012 statement, Sanders made the point that the F-35 would have to be located somewhere, whether in Florida or South Carolina or Vermont. “I would rather it be here,” he said.

Some of his constituents would rather it not. Residents around the Burlington airport sued to block the placement of F-35s there, but were rebuffed by the courts. The F-35s are scheduled to be based in the town starting in 2020.

Sanders’s campaign did not respond to a request for comment.

Much of the criticism of Sanders’s foreign policy stances have come from his left flank. The World Socialist Web Site called Sanders a “silent partner of American militarism.” And Counterpunch, a left-wing magazine, has criticized Sanders on more than one occasion for being insufficiently pacifist.

“He behaves more like a technofascist disguised as a liberal, who backs all of President Obama’s nasty little wars in Afghanistan, Iraq, Libya, Pakistan, Somalia, and Yemen,” wrote Thomas Naylor in the magazine. “Since he always ‘supports the troops,’ Sanders never opposes any defense spending bill. He stands behind all military contractors who bring much-needed jobs to Vermont.”

Sanders’s support of the Kosovo War led to the resignation of an adviser; when antiwar activists occupied his office, he had them arrested; and Sanders voted to authorize the war in Afghanistan, Howard Lisnoff wrote in the same publication.

“[R]eaders ought not to count on him to push back on the militarism and military actions that have become routine under both Democrats and Republicans who occupy the presidency,” Lisnoff added.

In New Hampshire, where the Democratic primary is being held Tuesday, Sanders rallied supporters at a downtown Manchester theater. For an hour, he railed against the big banks and the current minimum wage. He never mentioned national security policy—or the big defense corporations he sometimes supports.