A High Court judge in Zimbabwe on Friday ruled that the military action taken against ousted President Robert Mugabe was legal. The military’s actions “in intervening to stop the takeover” of Mugabe’s functions “by those around him are constitutionally permissible and lawful”, the judge George Chiweshe ruled, AP reported.

Chiweshe also said that Mugabe’s firing of his former vice president Emmerson Mnangagwa – who took oath as the new president on Friday – was illegal. The military had stepped in soon after the former president had fired Mnangagwa amid fears that he would try to push his wife Grace Mugabe to a position of power.

The judge’s ruling, however, has been criticised by Mugabe’s allies, while some experts are concerned about the precedent this would set for military intervention, AP reported. Dewa Mavhinga, the Human Rights Watch’s South Africa director, suggested these were the actions of a “captured judiciary” on Twitter.

Separately, former Finance Minister Ignatius Chombo appeared in court on Saturday to face corruption charges. Mugabe himself is likely to be protected from prosecution as he has been given immunity against legal proceedings.

Mnangagwa’s swearing in has brought Mugabe’s 37-year rule in Zimbabwe to an end. His government was accused of several human rights violations. Mugabe was also accused of maladministration, which has led to a collapse of Zimbabwe’s economy and healthcare system, among other administrative failures.