Lesotho’s prime minister has made a surprise appearance in court, where his lawyer argued that his office granted him immunity from prosecution for allegedly murdering his estranged wife shortly before he took power.

Thomas Thabane’s ex–wife, Lipolelo Thabane, 58, was shot several times at close range as she sat in a car near her home, two days before husband’s inauguration in 2017. She had reportedly refused a divorce and won a court battle to retain her privileges as first lady until any formal separation.

Thomas Thabane remarried two months after her death. His current wife, Maesaiah, 42, was charged with murder this month after briefly fleeing the country. Both deny any wrongdoing.

The case has now been referred to the High Court. Mr Thabane would be the first African leader to be charged with domestic murder while in office.

At Monday’s hearing, defence lawyer Qhalehang Letsika said: “My client cannot be prosecuted while in office but he is not above the law.”

The presiding magistrate referred the case to the High Court, which will be sitting as the Constitutional Court when it hears the case with a panel of at least three judges.

Thabane, 80, missed a court appearance last week because he went to South Africa for medical treatment. He also rejected reports that he had fled the country.

Lesotho is a constitutional monarchy and while the constitution states that the king cannot be charged with a crime, it is unclear on the fate of the prime minister.