Thomas Thabane has formally stepped down as prime minister of Lesotho following months of pressure after he was named as a suspect in the murder of his ex-wife.
The 80-year-old's current wife, with whom he was living at the time of the murder, was charged in connection with the killing in February.
The pair have denied any involvement.
Finance Minister Moeketsi Majoro is expected to be sworn in as Mr Thabane's replacement.
"The time to retire from the great theatre of action, take leave from public life and office has finally arrived," Mr Thabane said on national television on Tuesday announcing his resignation.
He said he was stepping down because of his age, adding: "I am no longer as energetic as I used to be."
He made no reference to the murder case but thanked his wife and "entire family for their unwavering support to me as prime minister".
He also made reference to the fractious nature of politics in the country, saying that some had tried to take advantage when he announced, in January, that he would be stepping down.
Lesotho has been plagued by political instability this year - he lost his majority in parliament last week when the coalition backing him fell apart and a new government is expected to be installed on Friday.
What happened to Mr Thabane's ex-wife?
Gunmen shot and killed Lipolelo Thabane on 14 June 2017 - two days before Mr Thabane was sworn in as prime minister.
While returning home, she was ambushed, shot several times at close range and died on the side of a dirt road. She was 58.
At the time, Lipolelo was going through a bitter divorce with Mr Thabane and had been living apart from her husband since 2012.
He had moved in with a new woman, Maesaiah Thabane, some time between 2012 and 2017.
Mr Thabane appeared in court in February for acting in "common purpose" but he hasn't been formally charged yet.
Who is Thomas Thabane?
Mr Thabane, 80, is one of Africa's oldest leaders and has spent most of his working life as a politician.
No stranger to political rivalry, Mr Thabane once fled to South Africa, alleging a coup plot by the military and had to be escorted back to Lesotho by the police.
Why hasn't he been formally charged?
In the February court case his lawyer argued that his position as prime minister granted him immunity from prosecution.
The case was referred to the High Court. But the High Court has not heard the case yet.
It is not clear why the case has taken so long to come to court.
Mr Thabane insists that the accusations against him are politically motivated.
Why has it taken so long for him to resign?
It may be that he was trying to negotiate with his party to get an agreement that the investigation would be dropped in return for him resigning.
If that is the case, it hasn't worked so far.
A spokesperson for Mr Thabane's party, the All Basotho Convention (ABC), told the BBC's Pumza Fihlani that it will not be supporting any attempt by him to get immunity.
He has resisted immense pressure from his own party to resign earlier.
Around the time of his court appearance he announced that he would not step down until July.
He cited old age as the reason for his resignation, without mentioning the murder case.
In April, South African mediators negotiated a deal which promised a "dignified" exit.
But a few days later he was reported to have said that he will not be pushed out of office until he is ready to leave and that nobody had the right to set the time for his departure.
What next for Lesotho?
The current finance minister, Moeketsi Majoro, looks set to be the prime minister. He has been appointed as the would-be leader of the new governing coalition by both the ABC and its ally, the DC (Democratic Congress).
The king of Lesotho - a tiny kingdom completely surrounded by South Africa - is being formally notified and it is expected that Mr Majoro will be sworn in at the royal palace in the capital, Maseru, on Wednesday.
Parliament will then reconvene on Friday, when the new government is expected to be inaugurated.