Prime Minister Narendra Modi's party has declared a landslide victory in crucial assembly elections in Uttar Pradesh, the country's most populous state, in a result that is expected to boost his claim to a second term.

The month-long, fiercely fought vote in Uttar Pradesh and four other states have been seen as a referendum on Modi's nearly three-year-old rule, especially after his controversial ban last year on high-value notes.

Modi's Bharatiya Janata Party (BJP) had won a clear majority in Uttar Pradesh, home to an estimated 220 million people, according to partial official results.

READ MORE: Uttar Pradesh vote a test for PM Modi after cash ban

The election commission said BJP was on course to win 309 of 403 seats in the state assembly, the biggest majority for any party in Uttar Pradesh since 1980.

Almost four in 10 voters backed Modi's party, the election commission said as it tallied the last votes, close to the party's vote share in Uttar Pradesh in the 2014 national election when it won the biggest national majority in three decades. Polls in the state are typically a bellwether of national politics.

"I give my heartfelt thanks to the people of Uttar Pradesh. This is a historic victory for the BJP; a victory for development and good governance," Modi told his 28 million followers on Twitter.

BJP also had won 42 of 70 seats and was leading in another 15 constituencies in another northern state, Uttarakhand, wresting power from the Congress party, the main opposition at the national level.

The Congress had a face-saving win in Punjab state, where it captured 70 of 117 seats and was leading in another eight voting districts.

It was fighting a close battle with the BJP in western Goa state and northeastern Manipur state, according to the Election Commission.

Final results from the elections, held in February and early March, were expected later on Saturday.

Cash crunch

The opposition Congress and other rivals of the BJP hoped that the voters would punish Modi's government for its decision to demonetise the country's highest-value currency bills last November, which brought immense economic hardships, especially to the poor.

Modi called India's massive demonetisation drive, which withdrew 86 percent of the country's currency bills from the system, to cleanse the system of tax evasion and corruption.

Banks and ATMs witnessed massive lines of people for months.

ATMs were not refilled for days and banks ran out of cash within a few hours of opening.