Director of Public Prosecutions Alison Saunders has dismissed suggestions that she is leaving the post because the government refused to renew her contract.
And Ms Saunders rejected criticisms of her five-year stint at the head of the Crown Prosecution Service, describing claims that standards had slipped as "hugely insulting" to prosecutors.
Attorney General Jeremy Wright confirmed overnight that Ms Saunders would leave in October. The search for a replacement is to begin immediately.
Her tenure in the post has been marked by a series of controversies - most recently over the collapse of a series of rape trials due to the late disclosure of evidence, leading to a review of every rape case in the country.
The government sought to play down reports that ministers had declined to extend her contract. The press notice announcing her departure pointed out that only one of her predecessors had served for longer than five years.
But the Daily Telegraph quoted an unnamed Whitehall source as saying that "it was made clear that her contract would not be extended" because it was felt a "clean break" was needed.
Ms Saunders told BBC Radio 4's Today programme: "They haven't said that to me at all. I told them that I wouldn't be asking for an extension, I was leaving at the end of my five years, so it has not been an issue for discussion."
She said that she had already decided to move on to the private law firm Linklaters in October before informing the government of her decision.
"It was my decision to leave," she said. "DPPs serve a term of five years. I was clear that five years was a good term to serve and I have already decided what I will be doing when I leave in October."
Criminal QC Daniel Janner branded Ms Saunders an "appalling" DPP under whose leadership the CPS had "fallen into disrepute".
Mr Janner said she should have stood down over the "fiasco" surrounding child abuse allegations against his father, the Labour peer Lord Janner. The CPS said there was enough evidence to merit prosecution but that it was not in the public interest to proceed - a decision which was overturned, only for the elderly former MP to be found unfit to stand trial shortly before his death in 2015.
"Within the legal profession ... she is regarded as somebody who simply wasn't up to the job," Mr Janner told the Today programme.
Ms Saunders said that criticisms of this kind were "incredibly inaccurate" and demonstrated a lack of understanding of the work of the CPS.
"We have 6,000 staff who who work really hard every day," she said. "Our performance across the last five years has been as good as (before) if not improving, despite the cuts that we have taken over that period.
"We have prosecutors up and down the country who come to work every day who make really important decisions about people's lives and do so professionally and well. I think it is hugely insulting to them to damn the service in that way."
Ms Saunders said that the disclosure problem was the result of a "systematic failing that has been going on for years across the criminal justice system, not just in the CPS", and was now being dealt with.
And she denied that the CPS was responsible for releasing the names of suspects - like DJ Paul Gambaccini, who was kept on police bail for a year before being told there was no case against him - before they have been charged.
"We certainly don't confirm people's names until they have been charged," she said, adding that it was a matter for Government whether suspects should be granted anonymity following arrest.
In a statement Mr Wright said: "I want to thank Alison personally for her service, not only as DPP but as an accomplished CPS (Crown Prosecution Service) prosecutor whose successful record includes the prosecution of Stephen Lawrence's killers.
"I have no doubt that she'll be greatly missed within the organisation."
Ms Saunders said it had been a "tremendous privilege" to be the first DPP to be appointed from within the CPS.