Walmart (NYSE:WMT) is sounding the retreat. After decades of expanding to the far corners of the globe, the retail giant is strategically regrouping around its U.S. base of operations with a primary focus on e-commerce. The latest market it realizes it can't win alone is the U.K.

In a major restructuring of the grocery market across the pond, the U.K.'s second biggest supermarket chain, Sainsbury, will buy Walmart's Asda chain -- the country's third largest -- to create a new industry giant that will surpass current leader Tesco in market share. Sainsbury will pay Walmart $10 billion for the chain in a cash and stock deal that will see Walmart end up owning 42% of the new company.

The combined Sainsbury-Asda company would have about $70 billion in sales, 2,800 stores, and 330,000 employees, a tie-up that is expected to generate $688 million in savings due to increased efficiency. Each chain will retain its own identity, no stores are expected to be closed as a result of the sale and merger, and two Walmart executives will join the board of directors. Not surprisingly, a deal of this size is expected to confront close regulatory scrutiny.

Woman with shopping cart in grocery store

Walmart has not been able to gain much traction in many foreign markets. Image source: Getty Images.

Consolidating its forces

Maybe it's not a full retreat, but rather another redeployment to the rear. Earlier this year, Walmart began seeking buyers for its Brazilian operations, and a decade ago, it sold out of Germany and South Korea. It has struggled in China and more recently partnered with JD.com (NASDAQ:JD) to more effectively compete there against Alibaba (NYSE:BABA) in the e-commerce sphere.

While Walmart's international operations generate some $118 billion in sales last year, or almost 24% of the retailer's $500 billion total, it has no real dominant position in any other market but the U.S. and Mexico. It is making a big play for India, where it is poised to acquire a 75% stake in leading online shopping giant Flipkart for $15 billion, but Amazon.com (NASDAQ:AMZN) has reportedly been trying to upend the deal with a bid of its own.

The growing worldwide battle with Amazon informs most of Walmart's strategic thinking these days, and it's partly why the retailer is dramatically reshaping its global ambitions. As China and India show, Walmart is more interested in developing digital solutions to competition rather than building out more stores.

Partnering for strength

The U.K. market has been a problem for Walmart, where it operates some 640 Asda stores, which it acquired in 1999 for $11 billion. The U.K., which represents Walmart's largest market by revenue, suffered from declining sales, and in the fourth quarter, gross profits were hurt as it cut prices to remain competitive. Last year, the international segment's operating margins declined primarily because sales in the U.K. fell even though it had relatively flat fixed costs. 

Because of the size of the company created by the Asda sale, analysts see it gaining leverage with suppliers, which would help it take on Amazon, as well as discount chains Aldi and Lidl, which are spreading in the U.K. every bit as much as they are here in the U.S. Sainsbury has already committed to cutting prices by 10% on products customers buy the most.

Still, simply merging doesn't resolve the problems Asda faced beforehand, so it seems like a smart move on Walmart's part to extract itself from a slow-growing (or non-growing) market, even though it will be recording a very large $2 billion non-cash loss on the sale. It is gaining $4 billion in cash, and using those proceeds in rapidly expanding India is a better bet.

Look at this deal as two steps forward, one step back, but with Walmart's strongest foot leading. If it can get past the regulatory challenges, the retail king will be in a better position at the end.

John Mackey, CEO of Whole Foods Market, an Amazon subsidiary, is a member of The Motley Fool's board of directors. Rich Duprey has no position in any of the stocks mentioned. The Motley Fool owns shares of and recommends Amazon and JD.com. The Motley Fool has a disclosure policy.