NEW DELHI (AP) — Prime Minister Narendra Modi's Hindu nationalist party fared worse than expected in two key Indian state elections, with the main opposition Congress party and regional groups posing an unexpectedly strong challenge just months after his party swept to power for a second term.

Although Modi's Bharatiya Janata Party was leading in the western state of Maharashtra, home to India's financial capital, Mumbai, preliminary results Thursday from Monday's elections showed it will secure fewer seats than in the previous state election in 2014.

Modi's party had expected to cross the majority mark of 145 seats in the 288-seat assembly on its own, but may fall well short of its 2014 tally of 122 seats, the results show.

Without a majority, the party will have to rely on its ally, Shiv Sena, to form a state government for a second term.

Modi's party fared far below expectations in the northern state of Haryana, where Amit Shah, India's home minister and a close confidant of Modi, had set a target of 75 of the 90 assembly seats.

Most of the BJP's ruling state ministers lost their seats as the party failed to win even a majority of 45 seats.

Congress, India's oldest party, and a key opposition group in both states showed an unexpected resurgence after a major defeat in the national elections earlier this year.

Results indicate Congress could end up doubling its seats in Haryana and remains in the race to form the government in the state if it manages to stitch together an alliance with other regional parties and Independent candidates.

The BJP was ahead of the opposition Congress-led alliance but after falling short of a majority, both parties are looking to woo the regional Jannayak Janata Party which emerged as a kingmaker.

In Maharashtra, Congress was lagging behind its ally, the Nationalist Congress Party, with voting marked by large-scale defections, with at least a dozen legislators of Congress and other parties switching sides to the BJP and Shiv Sena.

But Sharad Pawar, a key opposition leader in Maharashtra and an ally of Congress, saw the results as a vindication.

"People who left us have not been accepted. Defections have not worked in favor of those who left," said Pawar, whose Nationalist Congress Party is set to better its 2014 poll performance.

The BJP is likely to find itself in a possible confrontation with its ally in Maharashtra, as Shiv Sena chief Uddhav Thackeray said he has been "accommodating" during the national elections that were held earlier this year but "can't keep doing that anymore."

"I have to make sure my party flourishes," Thackeray said, infusing new life to reports that Shiv Sena wants to have a chief minister from its party.

Opinion surveys had predicted a BJP romp in the elections as the opposition campaigns were lackluster due to infighting and desertions in the run-up to the vote.

The elections in the two states are the first since Modi was reelected in May and are a test for his party, which is looking to tighten its grip on power across India.

The unexpected outcome for the BJP comes after a high-voltage election campaign in which it aggressively raised the nationalism plank by focusing on the government's scrapping of disputed Kashmir's special status in early August and targeting the opposition on national security and corruption.

Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.