Prime Minister Narendra Modi was heading for defeat on Sunday in a key election in India's big state of Bihar, signalling the waning power of a leader who until recently had an unrivalled reputation as a vote winner.
A defeat would be a setback for Modi's push to pass economic reforms because he needs to win most of the state elections in the next three years to gain full control of parliament.
An anti-Modi alliance was ahead in 125 seats in the 243-seat regional assembly, enough for an outright majority, unofficial tallies compiled by television channels showed.
Modi's Bharatiya Janata Party led in 103 seats of 238 where trends were clear, dealing a heavy blow to his leadership after he campaigned actively across the poor eastern state.
"The writing is on the wall. Modi's magic has failed and we have clearly won the battle," said Sanjay Singh, a spokesman for the regional parties led by Bihar Chief Minister Nitish Kumar.
Bihar is a gauge of many issues shaping Indian politics and the outcome will have a direct impact on Modi's premiership. If independent, its 104 million people would be the world's 13th-largest nation, more populous than Germany.
Modi turned the election into a referendum on his leadership after he addressed at least 30 campaign rallies, a departure from tradition in state elections, which usually centre on local issues and regional leaders.
The BJP is in a minority in the upper house of parliament, where seats are allocated according to a party's strength in the states, enabling the opposition to block Modi's reforms, including the biggest overhaul of taxes since independence in 1947.
Some TV channels rushed early in the count to "call" a handsome victory for Modi, and BJP party workers set off firecrackers and danced in the streets in celebration.
But as unofficial results trickled in, the picture quickly changed and by late morning all channels were predicting a win for Kumar. Official partial results, trickling in more slowly, also put his regional 'grand alliance' ahead.