Image copyright Reuters

Walmart will pay about $16bn to take control of Flipkart, India's biggest online retailer, in a deal that puts it head to head with Amazon.

The world's largest retailer will take a 77% stake, valuing the Indian company at more than $20bn.

Flipkart has been under pressure from Amazon since it arrived in India five years ago.

Amazon had been considering making its own offer for the Indian firm, which has more than 100 million users.

Walmart has been looking to expand in India for years and is flush with cash from recent US tax cuts.

Founded in 2007, Flipkart has high-profile investors including Japan's Softbank, which will sell its stake for $4bn - a profit of $1.5bn.

The combination with Walmart could be controversial, with concerns about how a deal might affect India's smaller retailers.

Online sales in India were worth $21bn last year, according to market research firm Forrester.

That total is expected to soar in coming years as more of its 1.25 billion population makes more use of the internet.

Analysis: Yogita Limaye, BBC business correspondent in Mumbai

Image caption Walmart's annual sales dwarf not only Flipkart but Amazon as well

This feels like a watershed moment for Indian e-commerce. Flipkart has so far been seen as the home-grown, domestic brand taking on America's Amazon.

The fact that most of it was already owned by foreign companies or that it is domiciled in Singapore didn't stop people from feeling pride about this Indian firm that had grown so quickly.

Its founders, Sachin Bansal and Binny Bansal, have been the poster boys of Indian e-commerce. Now the story changes though, from an Indian and American firm fighting it out, to India being the new battleground for the Walmart vs Amazon contest.

Image copyright Reuters Image caption Flipkart co-founder and chief executive Binny Bansal (right) with Walmart chief Doug McMillon

As far as consumers go, not much will change. Some analysts say buyers might even benefit as the two US companies try to increase market share.

However, the deal is facing some opposition. Confederation of All India Traders, one of the country's biggest traders' associations, has said it will "vitiate the e-commerce and retail market".

It has asked the government to press the pause button on the agreement until a national agreement for e-commerce is formulated.