Six months ago, it looked as if India was in for a bumpy recession. Factories were laying off workers and construction sites were grinding to a halt as foreign investment slowed to a trickle.

But in the last few months India has hit a gusher, as investors around the world have turned away from the dollar, the global refuge during the crisis, and rediscovered their optimism in the world economy and India’s place in it.

There is palpable optimism here. Major stock indexes have roughly doubled from their March lows. Companies are advertising initial public offerings on television. And articles about bonuses and corporate expansion plans have started replacing news about layoffs and deferred projects on the front pages of newspapers.

Nearly $7 billion (Rs32,347 crore) more foreign direct investment flowed into India than left the country from April through June, nearly twice as much as in the previous six months combined.

Including cash invested in the stock and bond markets, India received about $15 billion in foreign investment, the most it has received in any quarter except the last three months of 2007, according to Macquarie Securities.

If the current surge continues—and sceptics doubt that it can—the Indian economy could start growing at 8-9% a year as early as 2010, far sooner than forecasts by the International Monetary Fund and many independent analysts.

"Clearly after the big shock of last year, things are back on track," said Surjit S. Bhalla, who runs Oxus Research and Investments, based in New Delhi. “People are seeing the recovery to be lot more robust than what many of the naysayers are saying.”

While many say the good times are here to stay, some analysts worry that the renewed ebullience will be fleeting if global financial markets take another turn down.

Confidence in India’s potential could also falter if the government does not address some long-standing problems, namely, improved infrastructure, investment in education and economic reforms, as it has promised to do to lift hundreds of millions out of poverty.

Another big concern is that the foreign money might re-inflate bubbles in stock and real estate markets. Indian stocks are less than 20% shy of their 2008 peak, even though corporate profits and the economy as a whole are growing more slowly now. “Because we are a fairly large attractor of capital, the possibilities of bubbles building up in sectors like real estate are very real,” said Abheek Barua, chief economist at HDFC Bank Ltd, who is nonetheless upbeat about the economy. “It has clearly happened in China and there is some of that sort of problem here as well.”

For a country that quarantined its economy from the rest of the world for much of the last 60 years, India has increasingly relied on foreign investment in recent years. It has helped bridge the gap between domestic savings and the growing capital needs of the private sector and the government, which is borrowing money to pay for welfare programs and subsidies.

In the fiscal year ended in March, growth slowed to 6.7% from 9% a year earlier, in part because of lower foreign cash flows. Most analysts estimate the economy will grow more than 6% this year, but some, su ch as Bhalla, say growth will be as high as 8%.

Rising foreign investment should help offset some of the economic impact of erratic monsoon rains. The agricultural sector makes up around 17% of India’s economy but sustains more than half its population.

India’s economy lacks some of the handicaps present in other countries. For instance, domestic demand never collapsed to the extent it did in the US, and yet consumer spending is picking up now.

Car sales were up 13% in the five months that ended in August, compared with the same period last year. Builders say sales of affordable apartments—priced from $10,000 to $30,000—are up, too. Even retailers, who were forced to close hundreds of stores last year after overexpanding, are talking about opening new outlets.

Some Western companies are eager to get a piece of this market. Last month, Ford Motor said it would build and sell a new hatchback here. McDonald’s announced that it would open 120 more restaurants. And Baltimore-based T Rowe Price, according to local news reports, is in talks to buy a stake in an Indian mutual fund firm. T Rowe Price declined to comment.

At the same time, thanks to strong overseas demand for Indian stocks and bonds, companies here are raising billions of dollars. In a recent initial public offering for Oil India Ltd, a government-owned company, demand outstripped available shares by 31 times.

“There is a large amount of liquidity in the world,” said A. Murugappan, executive director at ICICI Securities Ltd. The money is flowing here, because “people see that India and China are the two growth areas.”

Still, the rising flow of foreign funds poses challenges.

India's currency has appreciated 11% since early March, to Rs46.13 to the dollar, because of rising demand for rupees and the broad decline in the dollar. That will make Indian garment and jewellery exports less competitive in the world market at a time when the industries are still recovering.

“That is a cause of worry,” Vasant Mehta, chairman of India's Gem and Jewellery Export Promotion Council, said about the appreciating rupee. “Profit margins are being squeezed, and in such a period we cannot expect to raise prices.”

The governor of the Reserve Bank of India recently said that to control inflation, his central bank might have to raise interest rates before developed countries, where rates are at historic lows. But he said that doing so could encourage overseas investors to move even more money into India, driving the rupee even higher.