LOSING the favour of the ruling Rajapaksa family is a cardinal error in Sri Lankan public life. Few in the press, especially not the mealy-mouthed state-run outlets, risk any criticism of the president, Mahinda Rajapaksa, or his powerful brothers. Parliamentary opposition, weak in numbers and leadership, rarely murmurs objections to those in office. Street protests by trade unions, students, religious leaders and Tamil activists are infrequent and usually brief.

So it is remarkable to see the country’s chief justice in conflict with the president. Few expected Shirani Bandaranayake to be any sort of check on the ruling family’s efforts to strengthen its grip on power. After all, she got the job after leading a bench of judges in 2010 that handily backed Mr Rajapaksa’s reworking of the constitution. This, known as the 18th amendment, scrapped presidential term limits and gave the president extra powers of appointment. A former judge describes the amendment as a national calamity, turning the presidency into a “juggernaut”.

As long as she was in favour, Mrs Bandaranayake appeared to thrive. Meanwhile, her husband had a plum post as chairman of the state-owned National Savings Bank. Yet last year relations soured. Judges and lawyers protested against the government after a minister reportedly threatened a local magistrate (whose courthouse was subsequently set alight). And towards the end of last year the secretary of the country’s legal commission, which appoints judges, sparred with the president’s office, warning that judicial independence was under threat. He was later badly beaten by goons while sitting in his car.

Yet the clashes have mostly centred around Mrs Bandaranayake. Benches she led started to hand down rulings that the government hated. Most notably, last year she confronted Basil Rajapaksa, a brother of the president in charge of the economy. The Supreme Court ruled against his controversial anti-poverty bill, known as the Divineguma Act, that would have handed him sweeping, discretionary powers over banks and public funds. The court blocked it twice, demanding revisions. After some changes, Parliament at last passed the bill this week.

The ruling clan is not pleased with the judiciary, and with Mrs Bandaranayake in particular. Her husband unwillingly quit his job in May, amid allegations of corruption. Separately, MPs from the ruling party, which controls over two-thirds of Parliament’s seats, began work on a motion calling for the impeachment of the chief justice herself. The speaker of Parliament happens to be another presidential brother, Chamal Rajapaksa.

MPs have the right to impeach a chief justice. The president’s spokesman points out that previous governments made similar efforts and that “this is a constitutional procedure”. A select committee packed with allies of the president weighed up 14 charges, including of financial impropriety, against the chief justice. After narrowing the list, they found her guilty of three of them. Four opposition MPs walked out of the committee, and various courts—including the Supreme Court and, on January 7th, the Court of Appeal—called its procedures and findings unsound.

Matters were due to come to a head as The Economist went to press. On January 10th Parliament started debating the case, with a vote to impeach Mrs Bandaranayake expected late the next day. Few doubt the outcome. A simple majority of MPs is needed. The president must then announce whether the impeachment should go ahead or not.

If Mr Rajapaksa chooses to proceed, it will provoke confrontation. The sleepy opposition may be showing signs, at last, of stirring—it warns of a “serious violation of the constitution and a breakdown of the rule of law”. Mrs Bandaranayake and other judges would almost certainly declare the whole process illegal. They would oppose any replacement for the top legal post. That would leave Sri Lanka’s judicial system in turmoil.

Talk is spreading in Colombo, the capital, of big protests. Various religious leaders have voiced alarm. On January 9th the Bar Association called a two-day strike. If Mrs Bandaranayake were forcibly removed from office or arrested, the anger would only grow. The president’s tactics may become so explicit that even usually docile partners—in Parliament and beyond—might begin to object.

A question of image

Nor does any of this look good to outsiders. Sri Lanka’s rulers are already beleaguered abroad in part for the decisive but brutal way in which they won the country’s long and nasty civil war in 2009, involving massacres of Tamils. Last year a United Nations human-rights body, in a vote backed by both America and India, called for a much more serious accounting of what happened.

Now Colombo is preparing to host its biggest international event in years, the biennial summit of the Commonwealth heads of government, in November. In theory that is a chance for Sri Lanka to showcase post-war progress to a large club of English-speaking democracies, natural allies and trade partners. Instead it risks becoming a moment of bitter confrontation or boycotts. The Commonwealth, after all, is supposed to promote better rule by its member governments. It would certainly look bad if its hosts appeared to be going in the other direction.