Palantir's (PLTR -1.38%) stock surged on Aug. 12 after the data mining and analytics company posted its second-quarter earnings. It beat Wall Street's estimates on the top and bottom lines, then provided a rosy outlook for the third quarter that surpassed analysts' expectations.

Should investors consider buying Palantir, which has been a volatile stock since its direct listing last September? Let's weigh three reasons to buy the stock -- against one reason to sell it -- to decide.

1. Accelerating growth in commercial revenue

Palantir's second-quarter revenue rose 49% year over year to $376 million, beating estimates by $14.5 million and matching its growth in the first quarter. It closed 62 deals worth $1 million or more, gained 20 new customers, and its average revenue per customer rose 19% year over year to $7.9 million.

An IT professional checks a tablet.

Image source: Getty Images.

Palantir's government revenue rose 66% to $232 million, while its commercial revenue increased 28% to $144 million. The growth of its government business decelerated slightly from the first quarter, but the growth of its commercial business accelerated significantly.

Revenue Growth (YOY)

FY 2019

FY 2020

Q1 2021

Q2 2021
















Data source: Palantir. YOY = year over year.

The commercial segment's acceleration counters the bearish argument that Palantir will struggle to expand its commercial business to reduce its dependence on government contracts. Government contracts, the bears often argue, have less long-term growth potential than commercial contracts.

Palantir mainly attributed its commercial growth to the U.S. market. Its U.S. commercial revenue surged 90% year over year, accelerating from the segment's 72% growth in the first quarter of 2021.

2. Expanding gross margin

Palantir remains unprofitable on a GAAP basis, and its net loss widened year over year in the second quarter, from $110.5 million to $138.6 million.

However, its adjusted gross margin, which excludes its stock-based compensation and other one-time expenses, expanded from 80% to 82%. Its adjusted operating margin jumped from 11% to 31%.

Those expanding margins suggest Palantir has plenty of pricing power in the competitive data mining and analytics market, and that its experience with the U.S. government -- for which it aims to become the "default operating system" -- is impressing large enterprise customers.

Palantir is also profitable on an adjusted EBITDA basis. Its adjusted EBITDA nearly quadrupled year over year to $121.5 million, which boosted its adjusted EBITDA margin from 13% to 32%. Its adjusted earnings of $0.04 per share also beat Wall Street's estimates by a penny.

3. Rosy short-term and long-term guidance

Palantir expects to generate $385 million in revenue in the third quarter, which surpasses the consensus estimate of $380 million.

It expects its revenue to rise at least 30% "for 2021 through 2025" -- which suggests it could nearly quadruple its annual revenue from $1.09 billion in fiscal 2020 to about $4 billion in fiscal 2025. It also raised its adjusted free cash flow forecast for 2021 from over $150 million to over $300 million.

That confident long-term forecast suggests Palantir's stock might not be as expensive as it initially seems, at about 30 times this year's sales.

The one reason to sell Palantir: The controversy

Palantir's platform, which gathers data on individuals from disparate sources to make AI-driven decisions, is powerful but controversial.

Palantir's Gotham platform is used by all branches of the U.S. military, as well as government agencies like the FBI, CIA, and ICE. It was even reportedly used to hunt down Osama Bin Laden back in 2011.

ICE uses Palantir's software to track down and report undocumented immigrants in the U.S. That controversial contract sparked protests from activists and Palantir's own employees, while employees at Amazon Web Services -- which hosts Palantir -- called for its shutdown.

Palantir withstood those protests, but it could still face more controversies as investors learn more about its government contracts.

Why I'm staying bullish on Palantir

I started a position in Palantir shortly after its direct listing, and sold a third of my shares after it more than tripled during the meme stock rally in January. But I plan to hold on to my remaining shares.

I'm staying bullish on Palantir because it's clearly a "best in breed" player in the data mining, analytics, and security space. Governments will require more of its services to solve domestic and foreign problems, and that hardened reputation will attract a growing number of enterprise customers.

Palantir has set clear goals for the future, and it could easily surpass its 2025 targets as it expands its government and commercial businesses. Those strengths should justify its premium valuation and offset any additional concerns about its more controversial contracts.