Indian Prime Minister Narendra Modi's ruling alliance is likely to win a big majority in parliament after a mammoth general election that ended on Sunday, most exit polls showed, a far better showing than expected in recent weeks.

Modi faced criticism early on in the campaign for failing to create jobs and for weak farm prices, and analysts as well as politicians said the election race was tightening with the main opposition Congress party gaining ground.

But he rallied his Hindu nationalist base and turned the campaign into a fight for national security after tensions rose with Pakistan and attacked his main rival for being soft on the country's arch foe.