Editor's note: Due to a production error, this piece overwrote an earlier, different story about the elections in Bihar. Many of the comments on this article relate to the earlier piece, which can be found here.

THE eastern state of Bihar has a population close in size to that of the Philippines: elections to its assembly matter greatly to its more than 100m, largely poor inhabitants. But the latest one mattered to Narendra Modi, the prime minister in Delhi, chiefly because of its importance in his quest to recast national politics to his advantage. And so the thrashing in Bihar of his Bharatiya Janata Party (BJP), at the hands of two Bihar political heavyweights who buried past enmities to oppose Mr Modi, represents the biggest setback in his political career.

Victory in Bihar would have sent, through indirect election, friendly faces to the national Parliament’s upper house—which, unlike the lower one, Mr Modi does not dominate. That would have helped him more easily push through bills aimed at fulfilling his pledge of economic reform. But more importantly, he and his electoral henchman, Amit Shah, the BJP’s president, intended Bihar to be a template for the party to spread beyond its strongholds in western and central India to become a truly national movement.

Other state elections loom, including in West Bengal in the east and Assam in the north-east, Uttar Pradesh (the most populous state) in the north and Kerala in the south. Do well in those, and by the end of 2017 the BJP would be well placed to gear itself for a general election two years later that could establish an almost presidential Modi rule. To give a measure of the importance Mr Modi placed in Bihar, he attended 30-odd election rallies in the state—extraordinary for a prime minister who presumably has much else to do.

Yet since the Bihar results on November 8th all longer-term calculations are moot—even whether Mr Modi will prove more than a one-term prime minister. The BJP ran against a “grand alliance” led by the state’s incumbent chief minister, Nitish Kumar (pictured), with a record of boosting growth and cutting poverty, and “Lalu” Prasad Yadav, whose corrupt and lawless tenure as chief minister in the 1990s came to be known as the “jungle raj” but who calls on large numbers of followers; the alliance seized more than three times as many seats in the state assembly as did the BJP (see chart).

In the general election in 2014 Mr Modi swept to a landslide victory with an aspirational message that highlighted growth and jobs. In Bihar he and Mr Shah are to blame for the ugliest and most socially divisive state election in memory. Caste is a critical fact of life—and politics—in Bihar, a state that is still nine-tenths rural. The grand alliance bolted together a coalition of the state’s middle- and lower-tier castes. The BJP tried to even the game by tying its traditional core from the upper castes to a cluster of small parties representing Dalits, the lowest of the castes.

But at a crucial moment the leader of the Rashtriya Swayamsevak Sangh (RSS), a Hindu-nationalist outfit that is seen as the BJP’s ideological parent, said India’s whole system of awarding benefits to lower castes was being abused for political ends and ought to be reviewed. That spread alarm among poorer groups. And then Mr Shah warned that a victory for the grand alliance would lead to celebrations in neighbouring Pakistan. His coded message to Hindu chauvinists was that, dangerously, the alliance was the party of Muslims, who make up 17% of Bihar’s population.

Attempting to pit the Hindu castes against Muslims—the BJP also made much of protecting the cow, sacred to many Hindus—was reprehensible. Fortunately, it did not lead to the kind of communal violence that has recently been ticking up elsewhere (and which BJP leaders have been slow to deplore when Muslims are the victims). Still, the results show that the BJP got punished for its crude tactics.

Back in Delhi, Mr Modi’s prestige is damaged. Party managers’ insistence on “collective” responsibility for the loss in Bihar is a charade. He and Mr Shah have run the party with an iron grip, laid down the electoral strategy and directly recruited RSS members as campaign foot-soldiers. Yet for the first time dissenters in the BJP—admittedly, none younger than 78—have spoken out. They said, in a jab at the overweening Mr Shah and his arrogation of authority, that the party had become “emasculated” over the last year. In private some of the prime minister’s advisers lament the trust he places in Mr Shah.

As for opposition parties, especially Congress, which the last general election annihilated as a national force, prospects look suddenly cheerier. Congress tagged along with the grand alliance in Bihar, and will want to do the same with dominant regional parties in other state elections. Such parties, meanwhile, have seen in Bihar the merits of ganging together to take on the BJP. But whether Congress is yet ready to learn the lessons of its national defeat is unclear. It suffers from a paucity of fresh ideas, venality on a grand scale, an underwhelming Gandhi/Nehru dynasty at whose pleasure the party serves, and an unwillingness to refresh its leadership.