The Army’s decision to go with Palantir, which was co-founded by Peter Thiel, the billionaire investor and sometimes adviser to President Trump, brings to a close the latest chapter in a fierce competition.

In March 2018, the Army chose Palantir and Raytheon to vie for the next phase of the Distributed Common Ground System (or DCGS-A, for Army), which lets users gather and analyze information about enemy movements, terrain and weather to create detailed maps and reports in real-time. The system is designed to be used by soldiers fighting in remote, harsh environments.

But critics within the Army and in Congress have for years complained that DCGS-A cost too much and didn’t deliver the intelligence and capabilities that soldiers needed. Some soldiers said the system was too hard to use and searched for alternatives.

Many became backers of Palantir, which sells to governments and businesses, including in the financial and health care sectors.

Palantir and its advocates argued that their software was cheaper and could meet all the Army’s requirements. But Army brass defended their decision to pay for a custom-built platform.

In 2016, Palantir successfully argued in court that the government was required by law to consider purchasing commercial products, when available, rather than custom ones.

That sent the Army back to the drawing board and led to the face off between Palantir and Raytheon.

Before his death. Sen. John McCain (R-Ariz.) praised the new approach on Twitter, noting that after the Army had already spent $3 billion in development costs, “it was time to find another way.”

Raytheon and Palantir were allowed to test their respective software platforms with a live audience of soldiers, who told them what they liked and didn’t and what they would change. The two companies then refined their offerings to suit the Army’s needs.

Traditionally, the government first chooses a company to build a system according to a set of detailed requirements. But this approach let the Army take both companies’ products for a test drive before settling on the winner.

“The Army changed its approach to acquisition,” Doug Philippone, a former Army Ranger who leads Palantir’s defense business, said in an interview.

He said the company was always confident it could win if it were allowed to adjust its technology after getting feedback from soldiers, who he said put the software through a rigorous test, even parachuting out of airplanes with reinforced laptops containing Palantir’s software.

Chris Johnson, a spokesman for Raytheon, said the company was disappointed in the outcome. “We will wait for the Army’s de-brief to understand their decision.”

The Army did not provide a comment for this story.

Raytheon and Palantir may compete for subsequent phases of work on the program.

Unlike most Silicon Valley start-ups, which aim to make their fortunes building consumer applications and software, Palantir at its founding set its sites on Washington, believing that its data analytics tools would find an eager market among U.S. spy agencies and the military, which are constantly trying to manage ever-expanding streams of information.

Philippone said the Army win had validated Palantir’s strategy.

“We founded the company around solving this particular mission,” he said.

The company faced initial skepticism from investors, who thought it couldn’t overcome entrenched bureaucratic interests and what they saw as political favoritism that led the Pentagon to spend billions every year with the same small group of Beltway contractors.

“Everyone told us we should stay away from Washington because it was corrupt and we didn’t know how to play golf with senators,” Joe Lonsdale, a Palantir co-founder, said in a 2011 interview.

The company got an early investment in 2005 from In-Q-Tel, the CIA’s venture capital arm, which tries to quickly develop technologies that the intelligence agency might use.