Controversial Assistant Commissioner Clint Rickards has resigned from the police.
Mr Rickards, who was found not guilty in two sex trials in the past two years, was set to face internal disciplinary charges but said his resignation meant all employment issues between him and police were resolved.
Mr Rickards' resignation is effective as of today. (Timeline of Clint Rickards' career)
In a statement released by his lawyer John Haigh, Mr Rickards said both he and police believed that maintaining the confidence by the New Zealand public in the police was of paramount importance.
"As long as this high profile dispute is allowed to continue it will dominate the headlines and confidence will naturally come into question," the statement said.
"Mr Rickards denies any wrongdoing and considers that any employment disciplinary proceedings are totally without foundation.
"He does however recognise the untenable position of him continuing in his role with New Zealand Police and in the interests of all parties has decided to resign."
Police National Headquarters in Wellington confirmed tonight it had accepted Mr Rickards' resignation
"In keeping with employer-employee relationship requirements, the conditions under which New Zealand Police's contract with Mr Rickards were met will remain confidential," a spokesman said.
Police Minister Annette King's spokesman said she "is pleased the matter has been resolved".
Mr Rickards, who has been with the police for 28 years, was suspended on full pay in February 2004 after being charged with sex offences relating to alleged incidents in Rotorua in the 1980s.
Mr Rickards, along with former police officers Bob Schollum and Brad Shipton, was found not guilty in March 2006 on charges of raping and sexually abusing Rotorua woman Louise Nicholas in 1985 and 1986.
In March this year the same trio were found not guilty of kidnapping and indecently assaulting a then 16-year-old girl, whose name is suppressed, in Rotorua more than 20 years ago.
It was revealed at the end of the second trial that Schollum and Shipton were already in jail after being found guilty of unrelated rape charges in Mt Maunganui.
Though cleared of the charges, questions were raised about Mr Rickards' involvement in group sex sessions in Rotorua with Shipton, Schollum and Ms Nicholas in the 1980s while a serving officer.
He also faced criticism for saying Shipton and Schollum should not be in prison for the Mt Maunganui charges.
Police had declined to say what internal charges Mr Rickards was facing.
Mr Haigh said the conclusion of the second trial was a highly emotional time for Mr Rickards.
"Mr Rickards wants to advise the New Zealand public that he has the utmost faith in the New Zealand judicial system and the New Zealand police service," he said.
"He also wishes to sincerely thank friends and those who have supported him and his family throughout this ordeal."
Mr Haigh said the cost of the legal battles "is something that will take many years for him to recover from".
* Born and raised in Rotorua. Of Tainui subtribe Ngati Hikairo, of Kawhia.
* Joined police at 18 in Rotorua. After four years there, has had posts in other centres, including Otahuhu, Hastings, Papakura, Gisborne and Hamilton.
* 1997: Appointed superintendent district commander, Gisborne.
* 1999: Appointed superintendent district commander, Waikato.
* September 2001: Becomes one of three assistant police commissioners, Wellington.
* January 2004: Takes on extra role as Auckland district police commander.