The US Army is retiring the standard-issue Beretta M9 after 35 years in favor of a more modern sidearm. And like so much tech these days, the new handgun is modular.

The pistol, called the P320, was originally designed by the German firm Sig Sauer for civilians in 2014, and it can be easily reconfigured to suit a variety of needs. The Army plans to purchase more than 280,000 of the handguns (and could eventually order as many as 500,000), and Sig Sauer says it will manufacture all of them at its factory in New Hampshire. The P320 has been on the market for civilians since 2014.

Sig Sauer entered the P320 in the Army's two-year, $350 million "Modular Handgun System" competition in which several manufacturers vied for a contract that could be worth as much as $580 million. The process dragged on so long that lawmakers questioned incoming Defense Secretary Gen. James Mattis about it during his confirmation hearing earlier this month. “This is a great testament to what’s wrong with defense acquisition,” said Senator Thom Tillis, a Republican from North Carolina, citing the age of the Beretta.

The P320 features interchangeable grips to accommodate hands of all sizes—something the Army needs, because the number of women in the service has grown significantly since the Army adopted the M9 in 1982. Beretta tried to preserve its Army contract by offering the M9A3, which has some improvements like new sights and better ergonomics, in 2014, but the Army wanted a fully modular handgun.

The Sig Sauer P320 accepts a number of attachments and accessories, like silencers. It is available in three sizes, and each can be modified for size and caliber to suit different conditions and assignments. For example, investigative work often requires a compact gun that is easily concealed, while soldiers in the field are most concerned with ease of use and durability. The P320 can convert between 9mm, .357SIG, and .40S&W calibers and Military.com reports that the army chose the 9mm P320 over a .40 caliber model that Sig Sauer also submitted to the competition.

Rather than design a sidearm from scratch, the Army decided to see what others might come up with. "We truly have optimized the private sector advancements in handguns, ammunition and magazines,” Army Acquisition Executive Steffanie Easter said in a statement.

So far, the P320 has earned positive reactions and experts say its adaptability and flexibility will save money over time. "It’s a very sensible choice," says Paul Scharre, the director of the Future of Warfare Initiative at the Center for a New American Security. Still, Scharre, who has worked on drone acquisition at the Office of the Secretary of Defense, says modularity can create problems if it isn't implemented appropriately. "Sometimes you can end up over-designing a system," he notes. "You want to make something that is modular for future options that you don’t yet know about. It’s hard because you’re trying to make a common system for things that aren’t common."

The quest to build a modular smartphone is one example of the struggle against over-design. But handguns have a finite number of features to consider, and Sig Sauer has spent years refining its modular handgun technology.