When Amit Shah, president of Narendra Modi's ruling party, meets with the Indian prime minister, he is sometimes asked a question he struggles to answer: "What is behenji thinking?"

By "behenji", or "older sister", Modi means Mayawati, the enigmatic politician and former ruler of India's most populous state, Uttar Pradesh.

Modi's keen interest in what the 60-year-old is up to reflects concern about his political prospects, amid an economic recovery that many poor Indians have yet to feel and rising social tensions among sizeable minority communities.

With a near-devotional following from tens of millions of people who, like her, belong to the bottom rung of India's social hierarchy, Mayawati is emerging as Modi's chief challenger in a key state election set for early next year.

"Mayawati is the biggest threat to our victory," Sanjeev Balyan, a federal minister in Modi's government, told Reuters.

"The one who becomes the chief minister of Uttar Pradesh gets to be the most powerful political leader after the prime minister."

Modi's Bharatiya Janata Party (BJP) swept Uttar Pradesh, home to 200 million people, in the 2014 general election, handing him the biggest parliamentary majority in three decades.

A repeat of that success would help Modi, who remains popular among most Indians, wrest control of the federal parliament's upper house, making it easier than it has been to pass key reforms.

It would also significantly advance his chances of retaining power when India chooses its next prime minister in 2019.

But violent attacks on Dalits, as those on the lowest social rung are known, are turning the opinion of some against the BJP and its Hindu nationalist supporters, giving Mayawati a new lease of life as she seeks a political renaissance.


WHERE ARE DALIT JOBS?

Mayawati is calling on minority groups to reject the BJP, whose roots are in Hindu nationalism that many Dalits and Muslims see as a threat to their way of life.

"Communal forces are becoming stronger," she told 300,000 cheering supporters, as she kicked off her election campaign at a sprawling park she built to honour lower caste Indians, previously known as "untouchables", in Uttar Pradesh's capital Lucknow.

"I want to ask the prime minister ... where are the jobs for Dalit boys and girls?" she said. "He will never understand the problems faced by us."

Speaking on the sidelines of the rally, Mayawati's Bahujan Samaj Party (BSP) general secretary Satish Mishra said Dalits and Muslims "were totally unsafe" under Modi, a view that reflects Mayawati's strategy to try and convince the two groups to vote as one.

Some lower caste voters deserted her BSP in 2014, allowing the BJP to win 71 out of 80 seats. But a series of attacks on Dalits this year has re-energised Mayawati.

Self-styled hardline Hindu cow protectors have targeted Dalits and Muslims who make money skinning dead cows, accusing them of killing animals sacred to Hindus.

In July, footage emerged of four lower caste men tied to a car, stripped and being flogged in Modi's home state of Gujarat, triggering violent protests.

Dressed in her trademark beige salwar kameez, Mayawati has sped across the country to appear at the side of victims.

"Mayawati has herself a godsend," said Ramesh Dixit, a former professor of political science at Lucknow University, referring to the attacks.


"FIRST-RATE EGOMANIAC"

Born into a family of leather workers and raised in a Delhi slum, Mayawati, unmarried and her private life fiercely guarded, lives in a windowless room in a palatial house with 20-foot boundary walls and a towering statue of herself in the garden.

A "Dalit Queen" to the millions destined to a life sweeping streets or rag-picking under the Hindu caste system that defines people by job, critics have accused her of lavishing money on luxury homes and diamond necklaces while ignoring the poor.

During her 2007-2012 term as Uttar Pradesh chief minister, she spent millions of dollars on vast memorial parks with life-sized marble and sandstone statues of elephants, her party symbol, of Dalit icons and of herself - echoing the region's 19th century Muslim rulers who built monuments to preserve their legacies.

A U.S. diplomatic cable released by WikiLeaks in 2011 described her as a "first-rate egomaniac" and she remains unapologetic about her personal extravagance, although officials in her party say she has since reduced the level of public pomp.

Mayawati declined requests for an interview.


BJP CHIEF'S 150 VISITS


Shah, one of Modi's most trusted confidants and his chief election strategist, is betting he can expand the BJP's appeal from its traditional base of prosperous and upper caste voters to less privileged Indians.

In the past 24 months, Shah has visited Uttar Pradesh more than 150 times.

Mayawati lost power in 2012 to the incumbent socialist regional party that is also expected to put up a tough fight in state elections provisionally scheduled for February.

But it is Mayawati whom Modi and Shah fear most, three sources close to the men told Reuters.

Dalits account for 22 percent of Uttar Pradesh's population, and Muslims, many of whom also feel disenfranchised by Modi, the BJP and their conservative Hindu backers, another 19 percent.

Modi has condemned the recent attacks, but an influential hardline Hindu organisation reminded him that open criticism of cow vigilantes would send the wrong signal to his natural support base.

The effort to win over Dalits gets to the heart of the dilemma facing Modi: he must placate wealthier and middle class Hindu voters while appealing to the broader electorate with a vision of a better future.


SHARING A MEAL

Caste remains a defining feature for people across poor and agrarian Uttar Pradesh, where India's two-decade economic boom has barely been felt.

No single community is numerous enough to win an election, forcing parties to widen their appeal.

Starting with Shah sitting down to share a meal with a Dalit family in May, the BJP has tried to project itself as siding with the poor, even as attacks on marginalised communities capture the headlines.

Shah has poached several high-profile leaders from Mayawati and plans to reserve up to half of Uttar Pradesh's state assembly seats for Dalits, one source close to Shah said.

Modi has praised the work of Dalit hero B.R. Ambedkar, and the BJP also wants to mould new icons from that community.

At this month's annual meeting of Hindu nationalist group Rashtriya Swayamsevak Sangh, the ideological parent of the BJP which holds considerable sway over the party, the chief guest was a member of the dirt-poor Dalit street sweeping community.


RISING ASPIRATIONS

Not everyone from the lower castes is sure of who will best serve them.

Fifty kilometres east of Lucknow, in Bedaru, villager Rampyari, illiterate and unsure of her age, is seeing the seeds of change that the BJP hopes will win votes.

Upper caste Indians have begun to permit her family to attend the same temple, although not at the same time, while a gas canister will shortly replace her wooden stove under a scheme launched by Modi.

Still, her support of Mayawati is unwavering, and upon hearing the name, Rampyari said: "She has to come back. Dalits feel empowered when she is in power."

But in a central Lucknow slum, Shobha Valmiki makes $25 a month collecting waste, and feels let down by her.

"Nothing has changed," she said, as goats and donkeys wandered down her rubbish-strewn lane. "They address me as scavenger, not by my own name."