Millions voted in India's most populous and politically important state on Wednesday, the first stage of an election that tests support for Prime Minister Manmohan Singh's troubled government ahead of a nationwide vote in two years.

The election in Uttar Pradesh, a state that is bigger than Brazil by population, could have a bearing on who next governs India. It is a closely fought four-way race pitting the scion of the elite Gandhi dynasty against a powerful low caste leader and two other parties. Results will be announced on March 6.

Rahul Gandhi of the central government's Congress party has staked his political reputation on reviving the party in a state it has not ruled for 22 years.

A good result could breathe new life into Prime Minister Singh's second term, which has been plagued by corruption and splits in the ruling coalition.

It would boost the party's morale hugely. A better performance of the party in these polls will give it the confidence it requires to strategise for the general elections in 2014, said Pralay Kanungo, professor at the centre for political studies at Delhi's Jawaharlal Nehru University.

The son, grandson and great-grandson of former prime ministers, Gandhi is considered likely to take over as prime minister from Singh, but the timing is not clear. He said this week that becoming prime minister did not interest him for now.

A poor showing in Uttar Pradesh would leave the Congress party weaker than ever as the country gears up for the general election. Congress now holds 22 of 403 seats in the local legislature and the most optimistic forecasts would give it about 80.

'OTHERS DID NOTHING'

Known as the queen of the lower castes for her power and lavish lifestyle, the chief minister of the state, Mayawati, has been criticised for building statues of herself and spending millions of rupees on diamond jewellery.

But supporters say she drove out violent mafias and made the state safe for former untouchable castes and other downtrodden groups after decades of abuse.

Uttar Pradesh, with 200 million people, is an unruly state that stretches southeast from New Delhi, divided along its length by the Ganges River. To avoid violence, voting is staggered over seven days. Results from a total of five state elections are to be announced on March 6.

Elections in Uttar Pradesh have traditionally been decided by voters' affiliation to the caste or religion they were born into. This year is no exception, with parties promising government jobs for the mostly poor Muslim and lower caste populations.

Mayawati helped the poor with education, and distributed bicycles to students, said 65-year-old wooden shoemaker Khairun Nisa, wearing a black traditional Muslim head-to-toe cloak. She didn't do as much as we hoped, but she did something, other governments did nothing.

We should give her one more chance, she said after casting her vote on a rainy day at a primary school in the town of Ayodhya. Turnout reached 59 percent by the close of voting, the state electoral commission said.

The destruction of a mosque by hardline Hindus at Ayodhya in 1992 sparked religious riots that killed some 2,000 people and brought the Hindu nationalist Bharatiya Janata Party, or BJP, to national prominence.

This time, religious tensions have cooled and parties are trying to woo voters with promises of welfare programmes, food subsidies and affirmative action for government jobs.

Mayawati's Bahujan Samaj Party -- which enjoys a majority in the state assembly -- is expected to take a battering as she loses the support of higher castes who voted for her last time but feel she failed to deliver economic development.

Both BJP and Congress are expected to pick up some of the votes she loses.

A scandal over funds for a health programme and linked to the murder of four senior doctors has hurt Mayawati, and a purge of corrupt officials this year was seen as coming too late.

Results are notoriously hard to predict in Uttar Pradesh -- where millions live in distant villages without electricity or clean water -- but several opinion polls suggest the Congress party could win enough to form a government with the leftist Samajwadi Party, which could emerge as the largest party.

The Samajwadi Party has a strong presence in the national parliament, and a tie up could allow the Congress party to reduce the influence of another volatile ally that has prevented Singh's government from passing major economic reforms.

(Writing by Frank Jack Daniel; Editing by Ron Popeski)