Read: Narendra Modi’s election challenge: Create jobs. Lots of them.

Modi had sought to refashion the judiciary almost from the outset of his premiership. A remodeling of the structure of the courts was included in his Bharatiya Janata Party’s manifesto in the run-up to the 2014 general election. Yet even with the sweeping mandate with which Modi came to power—his party was the first in 30 years to secure a parliamentary majority on its own—this was not going to be easy.

The principal barrier was the Supreme Court itself. Having been a willing party to Gandhi’s subversion of democratic institutions, the court had an image to rebuild. It did so gradually, expanding the purview of the judiciary in the legislative sphere and minimizing the role of the executive in the process of judicial appointments. Then, in 1993, it ruled that only sitting judges would be able to appoint new members of the judiciary. It was a coup of sorts. India’s founding fathers were cautious not to entrust senior judicial appointments with just one branch of the government. The constitution required the judiciary and the executive to work in consultation while appointing judges. But by the 1990s, the stain of corruption and other criminality had attached itself to politicians of all hues, and the idea of removing their influence from the judicial domain didn’t seem half bad.

The first significant legislation Modi’s government passed was a constitutional amendment to set up a body, including the federal law minister, that would oversee all appointments to the top ranks of the judiciary. In less than a year, the amendment was passed in both houses of Parliament, ratified by the requisite 17 state legislatures, and signed by the president to become law.

The backlash was swift: A clutch of petitions were filed in the Supreme Court challenging the amendment, and in October 2015, the court declared that the new rules were unconstitutional and void. The judgment seemed to show that the court had learned its lesson from its interactions with Gandhi, and was prepared to tame the tendencies of a majoritarian government.

But then those efforts began to unravel. In early 2017, a suicide note allegedly written by a former chief minister of the northeastern state of Arunachal Pradesh was circulated on WhatsApp. It claimed that the sons of two sitting Supreme Court judges, Chief Justice Jagdish Singh Khehar and Justice Dipak Misra, were seeking bribes to predetermine cases their fathers presided over. Though there was no corroborating evidence, the damage was done. When the matter came to the Supreme Court, a lawyer pressing for a full investigation alleged that a retired judge claiming to speak on Khehar’s behalf had approached him outside the court.

More claims followed against Misra, who would succeed Khehar as chief justice. The Central Bureau of Investigation, India’s top policing authority, arrested a retired judge from the high court where Misra had worked, alleging the retiree had tried to fix cases Misra was hearing in the Supreme Court. A colleague of Misra’s from his days as a lawyer detailed his long history of financial misdemeanors in an article I reported for The Caravan. Opposition parties proposed an impeachment motion against Misra, but the government refused to entertain it, and neither Khehar nor Misra recused himself from cases the Supreme Court was hearing in which the two were implicated. Soon after, ties between the government and the court would be brought into question.