NEW DELHI - Prime Minister Narendra Modi's Bharatiya Janata Party (BJP) returned to power in the western state of Maharashtra, but was falling short of a majority in the northern state of Haryana in a mixed set of results for a party that has seemed invincible.
The state elections were seen to be a test for the BJP, which highlighted Mr Modi's decisions like the removal of special autonomy for Kashmir and his fight against Pakistan.
In Haryana, the BJP, which was in power, won 31 seats and was leading in nine of the 90 assembly seats.
The opposition Congress party, which rolled out a lacklustre campaign and has been struggling to remain politically relevant, managed to win 25 seats in Haryana and was leading in six.
A small regional outfit called the Jannayak Janata Party (JJP) is seen as being crucial for the formation of the government in Haryana, but has yet to reveal who it would tie up with.
The BJP could still form the government if it gets support from the JJP or some independents.
It appeared confident of that prospect last night. Prime Minister Modi tweeted: "I thank the people of Haryana for blessing us. We will continue to work with the same zeal and dedication for the state's progress."
In Maharashtra, the BJP-led alliance was heading for victory, leading and winning 160 seats out of 288.
In 2014, the BJP won 52 seats in Haryana and 122 in Maharashtra, while the Congress party won 15 and 42 seats respectively.
The state elections are the first since Mr Modi returned to power in a landslide win in May's general election.
Still, the ruling party has been dealing with a worsening economic situation, with unemployment at a 45-year high and economic growth slumping to between 5 per cent and 6 per cent amid signs of distress in the rural economy.
It also comes after the Modi government removed autonomy and enforced a communication lockdown, which is now being slowly eased in the state of Jammu and Kashmir.
The decision to remove special autonomy from Muslim-majority Kashmir was a key campaign theme for the BJP, particularly in Haryana, which has a strong tradition of its young joining the armed forces.
It also highlighted its drive against illegal immigrants in the north-eastern state of Assam - where 1.9 million people are on their way to becoming stateless.
Analysts believe the election results in Haryana are a sign of voter discontent against the state government led by BJP Chief Minister Manohar Lal Khattar, and a failure to convert the popularity of Mr Modi into votes. They said issues like unemployment would have also been a factor.
"It's an issue of regional leaders. There are problems in their performance. Modi's popularity is still intact, but transforming popularity into vote is the responsibility of the party organisation in the state and the chief minister," said Mr Badri Narayan Tiwari, an Uttar Pradesh state-based political analyst.
Dr Sandeep Shastri, pro-vice-chancellor of Jain University, said the results in Haryana were a setback for the BJP. The BJP was also winning less seats in Maharashtra than it did in 2014.
"I would argue the BJP is on a backfoot after these two results. While the alliance has won in Maharashtra, I think (BJP ally) Shiv Sena will be able to assert itself much more as part of the alliance. At the end of the day, this is not the type of results the BJP has been hoping for. It has retained one state and come out bruised in the other state,'' said Dr Shastri.
"Haryana is a significant setback. For the BJP, it goes to show you cannot always rely on the leadership in Delhi. State leadership needs to have delivered. The BJP focused on the national election, but the voters were looking at local issues.''
Yet the results are also seen to be encouraging for the opposition parties from the Congress to regional outfits like the Nationalist Congress Party, subdued since the BJP's sweep in the general election.
"Maharashtra and Haryana assembly elections have once again proved: BJP is not invincible. Opposition needs to work hard,'' tweeted journalist and political analyst Nikhil Wagle.