Following months-long intense regulatory setback in India, Amazon is moving back to spending big bucks to grow its business in the world’s second largest internet market.

Amazon has infused Rs 2,999 crores ($404 million) in its India business, according to a regulatory filing published this week. Amazon periodically deploys cash to its business in India, the most recent infusion being around $315 million from its international arm six months ago.

The big spendings in India is the latest sign of how crucial the country has become for Amazon, where it entered exactly six years ago and has spent more than $5.5 billion. The bet has largely worked for Amazon, which rivals Flipkart, which was snatched up by Walmart for $16 billion last year.

The fight between the two companies for the tentpole position in India’s e-commerce market took a dark turn late last year, when the government announced new policies to mandate how these two companies source goods for their marketplaces. The local law prohibits Flipkart and Amazon to stock and sell their own inventories, so their wholesale units purchase goods in bulk and sell them to resellers.

To circumvent this, the two companies bought stakes in a number of companies that sell a range of products on their platforms. The new law, which came into effect on February 1, closed that loophole. As a result, hundreds of thousands of products disappeared from both the shopping sites overnight, according to some estimates.

Barclays claimed in a report last year, seen by TechCrunch, that Amazon was quickly closing in on the lead that Flipkart has in the e-commerce space in India.

In its six years in India, Amazon has sprawled its tentacles in many businesses other than e-commerce, including payments that recently started offering flight tickets, cloud services, video and music streaming services and in-house products that include a lineup of handsets that it worked closely to build and sell.

Even for a heavily funded company like Amazon, India has emerged as a very competitive market in recent years. In addition to Flipkart getting the backing of global retail giant Walmart, startups such as BigBasket, Grofers, Swiggy and Dunzo are quickly changing the way millions of Indians shop. And they have successfully courted major backers with deep pockets, too.

And then there is the ever-lingering Reliance Industries, the biggest industrial house in India owned by Mukesh Ambani, the richest man in the country. Earlier this year, Ambani said that Reliance Retail, the largest retailer in India. will join forces with Reliance Jio, a telecom operator that has disrupted the local market, to create an e-commerce platform.