Foreign portfolio investors poured $3.1 billion into Indian equities in August, the highest monthly inflow in nearly two years, aided by domestic companies' strong earnings outlook and the central bank's measures to stabilise the rupee.FPIs were net buyers for a second consecutive month, with their purchases in August being the largest since September 2024, National Securities Depository data showed on Friday.Still, they remain on course for the highest-ever annual outflows from ‌the country, with ⁠net sales ⁠worth $24.6 billion in the year so far, following a shift to markets with pure-play AI-linked companies such as Taiwan ​and South Korea earlier this year.Concerns about the impact of a surge in oil prices on India's inflation ​also pressured foreign buying, considering the country is the world's third-largest crude importer.Benchmarks Nifty and Sensex are down 7.8% and 9.7% in 2026 so far, among the worst-performing Asian and emerging markets.The ​trend, however, has reversed since July on worries that the companies ⁠making those ‌massive investments in AI infrastructure may not reap their profits soon.The Reserve ​Bank of India's ​measures to support the rupee and attract foreign money into debt markets, ⁠alongside a robust June-quarter earnings season, have also aided sentiment.Profit after tax for Nifty 50 companies rose by the highest in 10 quarters, according to at least five brokerages. Several brokerages such as Motilal Oswal and PhillipCapital have since upgraded their fiscal year 2027 earnings expectations."The key takeaway for domestic and foreign investors is that demand remains healthy, has beaten expectations and is continuing beyond the June quarter," said Hiren Dasani, chief investment officer for emerging markets at Singapore-based WhiteOak Capital.Dasani said the RBI also seemed ‌to have attracted sufficient forex inflows, considering the early closure of a special dollar-rupee swap window for banks that were raising foreign currency deposits from the ​diaspora.The addition to ​the RBI's dollar buffer ⁠could ease concerns around rupee volatility, a key consideration for foreign investors, he said."It should be treated as a sign of strength that the central bank has got enough dollars now, rather than ​a weakness, with the ability to stabilise the rupee on a much better footing now."Despite renewed foreign buying, weakness in heavyweights such as HDFC Bank and Reliance Industries dragged the Nifty and Sensex down 1.2% and 1.5% in August.The broader markets fared better, with nine of 16 major sectors posting monthly gains and the small-cap and mid-cap indexes rising 3.1% and 2.1%, respectively, to record highs.