Two states in the Hindi heartland account for a fourth of India’s population, around 300 million people, and send 120 representatives to the 545 member Lok Sabha (543 elected and two nominated).

The Bharatiya Janata Party (BJP) and its partners had won or were leading in 104 of these seats; the BJP alone 93.

In 2009, the BJP won 10 seats in Uttar Pradesh (it had won or was leading in 71 this year; its partner 2); in 2004, it won 10 again.

In 2009, the BJP won 12 seats in Bihar (it had won or was leading in 22 this year; its partners 9); in 2004, it won 5.

It was the BJP’s prime ministerial candidate Narendra Modi’s unofficial ADC Amit Shah who was sent by the Gujarat chief minister to Uttar Pradesh to win the state for the party, it was Modi himself who framed the Bihar strategy, forming alliances with key caste-based regional groupings.

Caste is an important factor in both states, dominated by people belonging to the other backward classes (OBCs), and Modi was clever enough to establish the fact that he is from an OBC himself, without overstressing the point.

The task in Bihar was rendered tougher by the fact that the BJP broke up with its long-term partner Janata Dal (United) last June. That party’s leader and Bihar chief minister Nitish Kumar—once spoken of as a possible Third Front candidate for prime minister—didn’t take kindly to the BJP naming Modi the chief of its campaign committee.

If the Bihar campaign was launched a year ago, so was the one in Uttar Pradesh.

Last May, Shah was made the BJP’s man in charge of Uttar Pradesh—a move aimed not just at improving the party’s prospects in the key state but also ensuring that all the party’s leaders in Uttar Pradesh fell in line.

Shah travelled around the state and formed polling-booth level committees for the elections.

“Amit Shah divided all the 80 seats into 21 smaller groups of four-five Lok Sabha constituencies. It was his idea to make Narendra Modi contest from Varanasi since the BJP had not performed well in eastern Uttar Pradesh. BJP had won only four out of the 18 Lok Sabha seats in eastern Uttar Pradesh and it was crucial for the party to perform well in this region," said a BJP leader involved in decision-making process of Uttar Pradesh who asked not to be identified.

Shah also believed that Modi’s candidature in Varanasi in eastern Uttar Pradesh would improve the party’s prospects in neighbouring Bihar.

The party also capitalized on the communal clashes in Muzaffarnagar in September last year to polarize the voters, especially Jats who, as a community, usually vote en masse for Ajit Singh’s Rashtriya Lok Dal (RLD). The RLD did not win any seats in the state.

Shah also forged an alliance with the Apna Dal, a caste-based regional party in eastern Uttar Pradesh that won two seats.

The party formed similar alliances with Ram Vilas Paswan-led Lok Janshakti Party and Upendra Kushwaha’s Rashtriya Lok Samata Party in Bihar. The two partners won nine of the 10 seats they contested.

An analyst said alliances and the smart use of the OBC card coupled with the party’s aspirational message of development played a role in the BJP’s turnaround in the two states.

“BJP and Amit Shah applied the aspirational narrative, including working over a complex topology of caste. That helped the BJP take its vote share to an all time high of 42%," said Jai Mrug, Mumbai-based political analyst. “Similarly, in Bihar it was Modi’s caste card peppered with a clear call on development that helped the BJP and its current allies get almost the same vote share of 38% that they had last time. Clearly, the first-past-the-post system helped the BJP in both the states, helping it win decisive numbers."

And the win in the two states, in turn, helped Modi and the BJP win India.