* BJP wins in Maharashtra, ahead in Haryana
* State elections the first since Modi's win nationally
* Pollsters had predicted Modi would romp to victory (Updates with final poll results; paras 4-6, edits)
By Rajendra Jadhav and Devjyot Ghoshal
MUMBAI, Oct 24 (Reuters) - Indian Prime Minister Narendra Modi's ruling party retained its control over a big western state on Thursday and was left scouting for an ally to keep hold of a northern state, after the two election races turned out to be closer than forecast.
Political leaders and analysts said the broad trends from Maharashtra, home to financial capital Mumbai, and the northern state of Haryana showed that while Modi remained the most popular leader, there were pockets of resistance emerging to his dominance.
The state elections were the first since he swept to power in the national polls over the summer riding a wave of nationalism focused against arch rival Pakistan and their central dispute over Kashmir.
Modi's Bharatiya Janata Party (BJP) and a regional ally sewed up a comfortable win in Maharashtra, winning 161 of the state assembly's 288 seats, according to the Election Commission of India. That's more than the simple majority required to rule one of India's richest states.
In Haryana, the BJP won 40 seats, with the main opposition Congress party cornering 31 seats. The state has a 90-member assembly, meaning either party will need an ally to form a government.
Jannayak Janta Party, a regional party that has emerged a likely king-maker in the state with 10 seats, has not announced who it will side with.
"The keys to the Haryana assembly will be with the Jannayak Janta Party," party leader Dushyant Chautala told reporters on Thursday.
But BJP chief Amit Shah indicated he was confident of coming to power in Haryana, congratulating cadre and voters in a tweet.
"I congratulate the public for making BJP the largest party and giving it a chance to serve again," said Shah, who is also India's home minister.
Still, the results fell below expectations after pollsters had predicted Modi would romp to victory, as did the BJP, which was confident of a better showing, particularly in Haryana.
"We are disappointed with our performance in Haryana. We were expecting a clear majority," a party official said, declining to be named.
And in Maharashtra, BJP's weaker performance compared with the last poll has led to demands from its ally Shiv Sena that the regional party have a greater say in the formation of the state's new administration.
Sanjay Jha, spokesman of the main opposition Congress, said that voters were unhappy with the BJP's inability to resuscitate a stagnant economy, address record joblessness and cut corruption, and were not swayed by the ruling party's campaign.
"People are seeing through it," he said. "Basically, hyper-nationalism, which is based on a very false foundation, has a limited shelf-life and I think they can't repeat that story again and again."
BJP leaders campaigned on Modi's decision to strike down Muslim-majority Jammu and Kashmir's autonomy in August in order to integrate it fully into India as a sign of his toughness and willingness to take on Pakistan, which disputes the territory.
Voters applauded a tough national security position, but they also were concerned about rising unemployment, rural distress and poor roads, said Mumbai-based political analyst Pratap Asbe.
Maharashtra and Haryana are both home to manufacturing units of major automobile companies, including Maruti Suzuki , Tata Motors, Mahindra and Mahindra , that have hit a rough patch because of falling sales.
India's passenger vehicle sales slumped 23.7% in September, the eleventh straight month of declines, prompting an industry body to flag more job cuts on top of some 350,000 workers the sector has already laid off this year if sales did not to pick up soon.
Overall, India's economy grew between April and June at its weakest pace since 2013, as consumer demand and government spending slowed amid global trade frictions.
Reporting by Rajendra Jadhav in MUMBAI and Devjyot Ghoshal in NEW DELHI, Additional reporting by Nigam Prusty in NEW DELHI; Editing by Sanjeev Miglani