Walmart is retreating from Europe, merging its UK supermarket business Asda with bigger rival Sainsbury's.

In return, Walmart (WMT) will receive £2.97 billion ($4.1 billion) in cash and a 42% stake in the combined business, the companies said in a statement on Monday.

The deal values Asda at £7.3 billion ($10 billion), and creates a mega retailer with 2,800 stores and combined annual sales of roughly £51 billion ($70 billion).

The sale of Asda follows Walmart's exit from Germany, its other major outpost in Europe, in 2006.

Walmart could use the cash to fuel its expansion in other international markets. The US retailer is reportedly close to agreeing to invest in India's Flipkart, an online retailer that has also attracted attention from Amazon (AMZN).

"This proposed merger represents a unique and bold opportunity, consistent with our strategy of looking for new ways to drive international growth," Judith McKenna, the CEO of Walmart International, said in a statement.

Related: Amazon and Jeff Bezos are on top of the world

The combination with Asda will give Sainsbury's (JSNSF) more firepower as it confronts digital competitors including Amazon and aggressive discount chains, such as Germany's Lidl and Aldi.

It also creates a new UK market leader: Sainsbury's and Asda together control over 31% of the grocery market, according to Kantar Worldpanel. The current industry front runner, Tesco (TSCDF), has nearly 28%.

Shares in Sainsbury's soared by as much as 21% in early London trading.

Regulators will have a close look at the deal, but the geographical distribution of Sainsbury's and Asda stores could limit concerns over reduced competition.

10% price cut on popular items

Upmarket Sainsbury's is strong in southern England, while Asda, which tends to have larger stores and lower prices, is well represented in the north. Together, the supermarket chains employ 330,000 people.

The UK Competition and Markets Authority last year approved Tesco's takeover of wholesaler Booker, saying the deal would not reduce competition in the sector, which is known for its razor-thin margins and frequent price wars.

Sainsbury's said it would retain both brands, and does not plan to close any stores. It expects to generate annual savings of at least £500 million ($688 million) through the merger and said it would use its larger scale to cut prices on many popular products by 10%.

The combined business will be led by Sainsbury's chairman and chief executive. The CEO of Asda and two representatives from Walmart will join the company's board. The deal is expected to be completed in the second half of 2019.