Walmart Inc. is selling most of Japanese retailer Seiyu to KKR & Co. and Rakuten Inc. in a deal that values the supermarket chain at 172.5 billion yen ($1.6 billion), as the U.S. giant retreats from its two-decade attempt to crack Japan’s retail market.

Under the agreement, private equity fund KKR will become the majority owner with a 65% stake, while Japanese e-commerce giant Rakuten takes 20%, the companies said in a statement Monday. Walmart will retain a 15% minority interest. Rakuten and KKR will seek to shore up Seiyu’s digital operations as demand for online retail grows in Japan amid the pandemic. The new owners are retaining a previously announced plan to re-list Seiyu in the future.

“An IPO is certainly common goal for us,” Eiji Yatagawa, a partner at KKR, told Bloomberg News. “What’s important is to build a business that can go public. For a company to go public, you need to demonstrate a very attractive story to the market.”

In June last year, Walmart said it would seek to relist Seiyu, following years of speculation that it was seeking to sell the chain after years of poor performance. While a 2018 report in the Nikkei newspaper said the Bentonville, Arkansas-based retailer planned to sell the business for as much as 500 billion yen, the company had repeatedly denied it was looking to exit. The price paid by KKR and Rakuten for the stakes was not disclosed.

Walmart expects to recognize a non-cash loss of about $2 billion after taxes in the fiscal fourth quarter related to the deal, according to a regulatory filing. The company “does not expect a significant impact to earnings per share following completion of the transaction.”

Walmart first invested in Seiyu in 2002 and took it private in 2008. But like other foreign retail giants, including Tesco Plc and France’s Carrefour SA, it failed to find success in Japan’s notoriously difficult and low-margin supermarket space, and struggled to compete with local rivals such as Aeon Co. and Seven & i Holdings Co.

In 2018, it began working with Rakuten on fresh produce delivery in Japan as well an e-book operation in the U.S. The U.S. giant has been reshaping its international operations to focus on high-potential markets like India and China, and investing to build its digital operations globally as it faces cost pressures and sluggish growth in its home market.

Fresh produce is a 60 trillion yen market in Japan, but only around 3-4% of that is online sales, according to Noriaki Komori, a Rakuten executive officer, creating a growth opportunity. Books and home appliance see about a third of sales online, he said. The pandemic has boosted e-commerce in Japan, where adoption has sometimes lagged other markets, with online clothes shopping and food delivery seeing notable gains.

The pandemic has also been boosting domestic Japanese dealmaking in the second half of the year following a downturn at the start of the outbreak, a surge that private equity firms including KKR as well as Carlyle Group Inc. have been seeking to get involved in. Carlyle in March raised 258 billion yen ($2.5 billion) for its fourth Japan buyout fund, while KKR has been increasing its involvement in the country, declaring Japan in 2019 to be among the most interesting buyout opportunities in the world. The heads of its Japan operations told Jiji in September that it aimed to do one or two deals totalling 300 billion to 700 billion yen a year.

The combination of online retailer — Rakuten runs Japan’s largest online shopping mall — with traditional brick-and-mortar store has echoes of Amazon.com Inc.’s $13.4 billion purchase of Whole Foods Market in 2017. Whole Foods has struggled during the pandemic, however, with foot traffic down an estimated 25%. Amazon’s Japan arm already runs a grocery delivery service with Life Corp., a supermarket chain.

“The world is very different today than it was 18 months ago for all of us,” said Judith McKenna, president of Walmart’s international business. “The world has accelerated in omni channel and digital transformation in the course of this year, not just in Japan but around the globe.”

The deal is expected to close in the first quarter of 2021. Seiyu Chief Executive Officer Lionel Desclee will stay in his role through the transaction and then take a new position within Walmart. A new CEO will then be appointed by a new board comprised of managers from the three owners.