Palantir's (PLTR -0.60%) stock was recently rocked by two major developments. First, the data-mining firm's stock dipped amid reports that it could lose its contract with Immigration and Customs Enforcement (ICE). But a few days later Palantir's stock rebounded after it secured a new U.S. Army contract. Let's examine these two news stories and how they could affect the company.

The potential loss of its ICE contract

One of Palantir's most controversial platforms is FALCON, a customized version of Gotham that ICE uses to track and deport undocumented immigrants. Palantir's work with ICE has sparked protests, internal disputes, and even calls for Amazon (AMZN 0.83%) Web Services (AWS), to stop offering its services to Palantir. Palantir co-founder Peter Thiel's outspoken support for former President Donald Trump's immigration policies exacerbated those tensions.

A digital illustration of a brain.

Image source: Getty Images.

Palantir has generated approximately $84 million to $111 million from the ICE contract since 2013, but it could lose that deal in the near future. In late September, a government document indicated ICE wanted to replace FALCON with RAVEn, a new platform that was custom built for the agency. The document revealed that ICE had conducted a market study for RAVEn in 2018, and initiated the project's first two contracts later that year.

ICE awarded those two contracts, which were worth a combined $43 million, to Booz Allen Hamilton (BAH 0.32%) and KCI Acuity. ICE recently extended those two contracts to early 2022, then rolled out three much larger development contracts worth $300 million -- which brought Amazon, Microsoft (MSFT 0.45%), Alphabet's (GOOG -1.22%) (GOOGL -0.95%) Google, and other tech companies to the table at ICE's industry day earlier this year.

Two years ago, ICE renewed Palantir's contract to 2022. But Palantir's days are still likely numbered, and any future contract renewals will likely depend on the agency's progress with RAVEn.

Gaining a new U.S. Army contract

Palantir's investors likely considered the ICE news to be a big setback for the company's long-term plans to become the "default operating system for data across the U.S. government." It also indicated the U.S. government was willing to court bigger tech companies to reduce its overall dependence on Palantir, which still holds 28 active federal-level contracts.

Two soldiers chat while working on a laptop.

Image source: Getty Images.

But on Oct. 5, Palantir secured a new $823 million contract with the U.S. Army to develop its CD-2 (Capability Drop 2) data collection and analytics platform, which will be integrated with Gotham and replace the Army's legacy programs. CD-2 complements Palantir's other modernization projects with the U.S. Army, which already include CD-1 (Capability Drop 1) and its TITAN (Tactical Intelligence Targeting Access Node) platform.

Palantir had been competing against BAE Systems (BAES.F 0.86%) to win the CD-2 contract since early 2020. The new deal has a base contract of four years, with an optional three-year extension.

The good news outweighs the bad news (for now)

Palantir may lose its ICE contract, which generated about $100 million in revenue over the past eight years, but it's gaining a new Army contract that could generate over $800 million in revenue over the next four to seven years. Therefore, the good news outweighs the bad news, and these developments won't derail Palantir's plans to maintain more than 30% annual revenue growth from 2021 to 2025.

Losing the ICE contract could even be a blessing in disguise for Palantir, since it would end its most controversial partnership. Meanwhile, securing the CD-2 contract will tighten its relationship with the U.S. Army as well as the other branches of the U.S. military.

Palantir's stock has more than doubled since its direct listing a year ago, and it still isn't cheap at 30 times this year's sales. But if you believe Palantir can achieve its long-term growth targets by expanding its Gotham platform for government agencies and Foundry platform for enterprise customers, it could still be a lucrative long-term investment in the high-end data analytics market.