By Tommy Wilkes and Rupam Jain

NEW DELHI (Reuters) - Indians headed to the polls on Wednesday in the final lap of a race for the country's most politically important state, the biggest mid-term verdict on Prime Minister Narendra Modi since he stormed to power three years ago.

The election has been staggered over seven phases in Uttar Pradesh, a poor and agrarian state home to 220 million people, and the final phase includes the ancient Hindu city of Varanasi, Modi's home constituency. Results of the election, as well as those in four other Indian states, will be announced on Saturday, and help to shape the next two years of Modi's government as he heads toward a 2019 general election.

The outcome will also show whether support for Modi's party has held up after his shock decision last November to ban big banknotes to crack down on tax evasion and bribery.

Police on Wednesday stepped up security for final voting in Uttar Pradesh after they said they had shot dead an alleged Islamic State-inspired militant in Lucknow, the state capital.

The election, the world's largest democratic exercise this year, has been largely peaceful, but police arrested five men suspected of involvement in a small explosion on a train this week.

"ONE-MAN PARTY"

Modi has campaigned hard to win Uttar Pradesh, holding more than 25 rallies after a lackluster start to his Bharatiya Janata Party's (BJP) campaign following a tie-up of two opponents that upset voting calculations.

"The election is much closer than we thought it would be," pollster Praveen Patil told Reuters. He put the BJP marginally ahead of the alliance between the ruling Samajwadi Party and the Congress party, but within the margin of error and far from ensuring the BJP a majority in the 403-seat assembly. "The BJP is a one-man party. After realizing that they were trailing, they were left with no option but to press Modi onto the campaign trail," Patil said. A third party, popular among lower-caste Indians in a region where most people vote along social and religious lines, appears to be recovering some lost ground, analysts said, strengthening the chances for a hung state assembly.

WINNER TAKES ALL Clinching a vote share of more than 30 percent in the three-way contest could deliver a landslide result, under India's first-past-the-post system.

Modi swept the battleground state in 2014 on the way to the biggest parliamentary majority in three decades.

Exit polls are due late on Thursday. They have often been wrong in the past, but any clear trend showing Modi in front could trigger further buying by investors who have pushed the benchmark NSE share index toward a record high. "If Modi wins it's going to be a huge boost," said Shumita Deveshwar, a policy analyst at macro advisory firm TS Lombard. "Even if they fall short but are still first, markets will take it in their stride."

Modi's campaign in Varanasi, where the prime minister spent three days and fielded 20 ministers and BJP leaders, was a desperate attempt to regain lost ground, said a spokesman for the Samajwadi party of state Chief Minister Akhilesh Yadav. "This was their last attempt to defeat us, but it seems like they will stand defeated," Ghanshyam Tiwari said.

Voters in tiny northeastern Manipur also headed to the polls on Wednesday, with voting in three more states having wrapped up last month.

(Additional reporting by Douglas Busvine; Editing by Clarence Fernandez)