It is often said U.S. retail giant Walmart Inc is like a country of its own and its gargantuan revenues justify the comparison. Sample this: The number one ranked Fortune 500 company clocked revenues of half a trillion dollars in 2018. That is almost twice the amount the Indian government raised from tax revenues, non-tax revenues and asset sales put together in 2017-18.

While the scale is enviable and puts Walmart in a league of its own, pushing the Beast of Bentonville to keep pace with the changing realities of the world is a hard task. And that task was handed to Doug McMillon in 2014, when he was elevated to the position of chief executive officer.

On the one hand, McMillon had to find new markets and stem the rot in revenue growth. On the other, he had to play catch-up with Jeff Bezos’ Amazon in e-commerce across the world. A Fortune article from June 2015 describes the time that McMillon took over as a “critical juncture” in the history of Walmart.

McMillon has moved fast on e-commerce with acquisitions such as U.S. e-commerce company But so far, Wall Street hasn’t appreciated his decisions. Not as much as Jeff Bezos’ Amazon in any case. According to NYSE data, Amazon’s market cap increased nearly sevenfold after McMillon’s appointment and in the process overtook Walmart, which has remained largely flat.

The reason perhaps is a slowing down of international business. Global business clocked revenues of $118.07 billion in 2018, down 14% from $136 billion in 2014. Although the company attributes the drop to exchange rate fluctuations, it was also due to its inability to compete with local players. For example, the supermarket chain Asda, which it bought in 20 years ago, remained number three in the U.K. market. It also had to scale back in Brazil as the country was hit by an economic slowdown.

McMillon responded by making Judith McKenna president and chief executive officer of Walmart’s international business in 2018. Within months of her being elevated, the sale of Asda in has been followed by the biggest a purchase in Walmart’s 56-year old history, a $16 billion deal for a 77% stake in Flipkart, India’s largest e-commerce firm.

As expected there was apprehension on Wall Street. At an investors’ call, analysts from various brokerage houses expressed concern on a range of subjects, including the logic of selling a cash-generating business in the U.K. versus buying a cash-burning business in India, and the lack of clarity on when Flipkart would turn profitable. The result: Walmart’s shares fell 4.5% on the NYSE once trading opened after the announcement before settling 3.13% higher at $83.06.

The market has a mind of its own, but in this case it is safe to say McMillon and his team’s lucid answers on the rationale behind the merger and their future plans have struck a chord.

“As Flipkart is expected to generate meaningful losses for at least the next few years, this is clearly an investment for the future, and when viewed in tandem with the recently announced sale of a majority stake in Asda, is indicative of Walmart's long-standing strategy of shifting resources into higher growth potential markets and segments when opportune,” wrote Moody's analyst Charlie O’Shea in a research note.

Addressing one of the concerns at the investors’ call, McMillon said, “The plans that we have in place for the ongoing investment in the U.S., are not affected. However, we are being choiceful in our investments. The announcements of the U.K. are representative of that. We are putting in investments where we see opportunities.”

McMillon also made it clear that he does expect Flipkart’s losses to continue in the short-term but the investment decision is based on the long-term potential of the company and the Indian market. “If we were to look at a three-five year horizon we would not have made the investment here… There just aren’t opportunities like the one we are looking at. India as a country, as a growth rate, the GDP, the growth of the middle income, the scope for adoption of technology. In retail in India, e-commerce is the place you want to be. The payments, fashion, and logistics business is an added advantage,” he said.

At the investors’ call, McKenna also explained another crucial strategic reason for the investment in Flipkart. According to McKenna, Walmart will try to leverage its existing operations in cash-and-carry to have an omni-channel presence in the future to better service the customer.

Even Walmart’s existing partnership with local farmers may be put to use immediately through the Flipkart acquisition. “The Flipkart team says there is a good opportunity with food in India. So it is one of those areas where we bring in expertise and we would look to develop that business,” McKenna added.

The Walmart management expressed confidence that Flipkart’s acquisition will help the Bentonville, Arkansas-headquartered company with its e-commerce ambitions in its home market. “There is a strong tech team here. I have really enjoyed the interactions we have had. I do believe that we will get learning out of Flipkart that will help the rest of the business. We have a sourcing operation here. We have seen some great talent. I believe we will see people come out of India to lead some of our businesses,” says McMillon.

Time will tell whether Flipkart delivers on the promises for Walmart. But, if nothing else, four years after an acrimonious split with the Bharti Group ended its first attempt to enter India, the world’s biggest retailer will finally be able to sell directly to Indian customers. That itself is a better achievement for McMillon than his predecessor Mike Duke. Given that the company's slogan ‘Save Money. Live Better’, a shortened version of founder Sam Walton’s famous quote, is a mantra that Indians have always lived by, Walmart and Indian consumers could be a marriage made in heaven. But the risk is that Flipkart keeps making Walmart bleed money in its ongoing battle with Amazon. The winner without a doubt is the consumer.

Follow us on Facebook, Twitter & YouTube to never miss an update from Fortune India. To buy a copy, visit Amazon.