After decades arming American soldiers, first with the Vietnam era M16 and later the modern M4 rifles carried in Iraq and Afghanistan, famed gun manufacturer Colt lost its contract with the military in 2013. It never recovered. Last Sunday Colt Defense LLC filed for bankruptcy after 179 years in business.

Colt’s chapter 11 filing comes after earlier, failed attempts to restructure its $350 million debt were rejected by the company’s bondholders. Last November, The Wall Street Journal reports, Colt borrowed $70 million from Morgan Stanley in a bailout loan to allow the company to pay down interest on its debts. Under an article of the bankruptcy code, Colt is now headed to auction, where it’s hoping for a quick sale. The company lists its sponsor Capital Management LLC, as its “stalking horse bidder,” meaning that Sciens, which which owns close to 90% of the company, has agreed to buy out Colt’s assets and secured liabilities.

The downturn for Colt seems to have started after the company, which had relied on sales to the government, lost a multimillion-dollar bid to arm the military.

Following a drawn-out and contentious bidding war, Colt lost its contract to provide the Pentagon with M4 rifles in 2013. The $77 million contract went instead to a Belgian company, F.N. Herstal.

A source familiar with Colt’s financial situation characterized the 2013 loss of the contract to provide the military with M4s as “tough to quantify” but called it “definitely the main contributing factor to the business being where it is.”

Problems had plagued Colt’s version of the M4 for years before it lost the bid.

Among soldiers who relied on it, the rifle was often criticized as being unreliable—good in sterile conditions but prone to malfunctioning once it got dirty, as it often did in Iraq and Afghanistan.

In 2007, Colt’s M4 finished last in an “extreme dust test” that pitted the rifle against models made by rival manufacturers. Despite the poor showing, Army leaders said they were still confident in Colt’s design.

The Colt M4 was good enough for the conventional military but special operations units with more money and latitude began ditching the weapon years before the Pentagon abandoned it. “The Army’s Delta Force replaced its M4s with the H&K 416 in 2004 after tests revealed that the piston operating system significantly reduces malfunctions while increasing the life of parts,” Army Times reported in 2007.

Losing the Pentagon’s business in 2013 may have been the worst blow to Colt, but the company faced other challenges.

Foreign Policy’s David Francis points out that it’s not just the military that has turned away from Colt. “Law enforcement officers are increasingly turning to Glock pistols as a sidearm,” Francis writes, “as opposed to Colt’s 1911 gun.” He attributes the shift to officers’ believing “the Glock to be a more reliable pistol,” and describes “a long record of complaints about the Colt gun jamming.”

On top of losing business from the military and police Colt’s corporate structure prevented the company from capitalizing on a boom in gun sales after the election of President Obama. Because the company had created separate entities for its military and private gun owner business, “the severed halves of Colt somehow missed the post-2008 “Obama surge” as much as other U.S. gun manufacturers,” Paul M. Barrett wrote last year in Bloomberg Business in an article warning about Colt’s financial decline.

On Colt’s missed opportunity to cash in on the post-Obama gun frenzy, Barrett wrote:

“Whipped up by NRA warnings that the Democratic president intended to toughen gun control, consumers cleared gun store shelves of ammunition and weapons. Better-prepared manufacturers such as Glock saw sales rise sharply. Under the terms of the Colt split, however, Colt Defense could reach the booming civilian market only by first selling its rifles to Colt’s Manufacturing, a debilitated company with sclerotic lines of distribution.”

Those missteps aside, Colt may be changing hands but the gun-making business does not appear to be threatened by the bankruptcy proceedings.

In an official statement, restructuring Officer Keith Maib said, “Colt remains open for business.” That’s thanks to a pending $20 million loan to keep its Connecticut-based manufacturing operations going. Colt’s future will depend on what happens next now that it’s up for sale.