Image source: The Motley Fool. 

Warren Buffett's Berkshire Hathaway (NYSE:BRK.A) (NYSE:BRK.B) dumped its Wal-Mart (NYSE:WMT) holdings this past quarter. 

The conglomerate trimmed its stake in the world's largest retailer by 27% from 55.24 million shares to 40.23 million, leaving it with about $3 billion worth of Wal-Mart stock. Berkshire first began buying Wal-Mart in 2005, and in many ways, the retailer has historically been a typical Buffett stock. 

Wal-Mart is the clear leader in retail, with about triple the sales of any other competitor. It grew voraciously over the last few decades by blanketing the U.S in superstores and acquiring subsidiaries abroad. With a strategy of everyday low prices and the economies of scale to ensure it could beat any competitor, the company was once unstoppable, offering the competitive moat that Buffett so values. From 2000-2010, revenue grew from $165 billion to more than $400 billion. However, in recent years, Wal-Mart's stampede has slowed. 

WMT Revenue (TTM) Chart

WMT Revenue (TTM) data by YCharts.

The biggest factor in its sluggish growth appears to be the rise of e-commerce led by (NASDAQ:AMZN). Amazon has tested Wal-Mart's claim to low-price leadership, and its network of warehouses across the country has given an edge in convenience for many shoppers with its Prime loyalty program, which offers free two-day delivery. 

Buffett himself has recognized the power of Amazon and, with it, the threat it presents to Wal-Mart. The Oracle of Omaha has repeatedly rained praise on Jeff Bezos, the founder and CEO of Amazon.

In an interview with CNBC, Buffett said, "We haven't seen many businessmen like him," calling his ability to transform retail with Amazon "remarkable" and that he had an "amazing talent in figuring out how to please customers." 

In 2013, Buffett called Bezos a "really smart guy" and a "great businessman" after Bezos bought The Washington Post, in which Buffett was a major shareholder at the time. 

Last quarter did not mark the first time Berkshire dumped Wal-Mart shares as it sold 4 million shares last fall, meaning it's reduced its stake by about a third since last year. 

Chronic underperformance

Buffett has not directly addressed Berkshire's stake in Wal-Mart, but the stock has been a dud since Berkshire first bought the retailer. As the chart below shows, Amazon has jumped more than 2,000% since Berkshire invested in Wal-Mart, but the retail giant has even lagged the S&P 500.

WMT Chart

WMT data by YCharts.

Wal-Mart stock was a big winner through 1980s and '90s, but its share price stalled after the tech bubble burst as investors waited for profits to grow into its valuation.

Today, the company is facing a different dilemma. It's saturated the retail landscape with stores, but needs to build an e-commerce business worthy of competing with Amazon. Though Wal-Mart is still the clear leader in revenue, its huge sales figure makes it Amazon's biggest target. If it can't remain competitive, those sales could start to disappear.

Wal-Mart's latest earnings report offered some encouragement. The company saw e-commerce sales growth accelerate for the first time in two years and comparable sales increased to 1.6%. The retailer's investments to clean up stores, eliminate out-of-stocks, and roll out programs like grocery pickup seem to be paying off. Still, the threat from Amazon is only getting bigger as North American retail sales grew 28% in its most recent quarter and could top $80 billion this year.

With his reverence for Bezos and Wal-Mart's competitive advantage eroding, expect Berkshire to dump more of its stake in Wal-Mart over the coming years.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.