The U.S. Army has selected the Sig Sauer P320 handgun as its new sidearm, replacing the Beretta M9. The announcement, which was broken yesterday afternoon by Military.com, was made at the Las Vegas SHOT Show trade convention. The handgun will be known as the M17.

320f-9-bss-rx

“By maximizing full and open competition across our industry partners, we have optimized private sector advancements in handguns, ammunition and magazines, and the end result will ensure a decidedly superior weapon system for our warfighters,” Army Acquisition Executive Steffanie Easter said Thursday in a press release.

Related: What The Army Needs In A New Service Pistol »

The compact version of the P320 won the competition, beating out FN America, Beretta USA, and Glock for the contract worth up to $580 million. According to The Firearm Blog, the compact P320 has an overall length of 7.2 inches and a barrel length of 3.9 inches. Military.com reports Army has reportedly chosen the 9-millimeter version of the handgun, which packs a 15-round magazine. The weapon is fully ambidextrous, with safety and slide-catch levers on both sides, and has a bright orange, loaded-chamber indicator. The handgun also features a flap in the trigger well to prevent dirt and debris from entering the pistol. Unlike the Glock, troops won’t have to pull the trigger to disassemble it.

The Army will initially buy more than 280,000 handguns, and may purchase another 212,000. It also plans to buy approximately 7,000 sub-compact versions. The P320 compact has a civilian market price of $597 each that technically be enough to buy 971,524 M320s — and that’s before bulk discount savings.

The Army search began searching for a new handgun in 2013, and announced the XM17 Modular Handgun System competition the next year. The current Army-issue sidearm for more than 30 years, the Beretta M9, has a long history of problems. In a 2006 report on U.S. infantry weapon reliability, troops who had used the M9 in combat in Iraq and Afghanistan ranked it dead last compared to the M4 carbine, M16 rifle, and M249 squad automatic weapon. Only 58% of soldiers who had used it in combat reported being satisfied with the weapon. Of the four weapons, it was reported the least accurate and worst handling.

Most alarmingly, 26% of those who had used it in combat reported the Beretta had jammed on them.

The world of firearms has seen a lot of innovation in the 32 years since the Beretta 92 was chosen, and the XM17 requirements were written to include many of them. The gun was required to have an integral MIL-STD-1913 Picatinny rail, the same accessory mounting system incorporated on other Army small arms, as well as a threaded barrel for the installation of suppressors. The program also called for ambidextrous controls for lefties and a loaded-chamber indicator. The modular-ness of the gun needed be swappable grip panels of different sizes, to accommodate hands of different sizes — an important feature when the number of women in the U.S. Army has increased by 50% since the M9 was adopted.

Oh, and the weapon needed to have low recoil.

The final solicitation, which spelled out what the Army officially wanted in the pistol and how the competition would go down, came in at a whopping 351 pages. Rather than an afternoon, or even a long weekend, the competition would take an estimated two years to cost of $17 million.

Sen. John McCain of Arizona complained the competition rules were “byzantine” and favored large companies used to negotiating government bureaucracy. Then-Sec. of Defense Robert Gates complained, “This is absurd…it’s a handgun for God’s sake.” Even Army Chief of Staff Gen. Mark Milley expressed exasperation with the process, saying, “We’re not figuring out the next lunar landing. This is a pistol. … You give me $17 million on a credit card, and I’ll call Cabela’s tonight, and I’ll outfit every soldier, sailor, airman and Marine with a pistol for $17 million.”

Perhaps it was the attention drawn by the the program’s delays in last week’s Senate confirmation hearings that pushed Army to make a decision. In Gen. James Mattis’ hearing, Iowa Sen. Joni Ernst said, “Take a look at their 350-page micromanaging requirements document if you want to know why it’s taking so long to get this accomplished.”

In response, Mattis said, “I can’t defend this,” but added, “I will say that at times there were regulations that required us to do things.”