SAN FRANCISCO (AP) — Oakland top officials have apologized and vowed to clean up the city’s troubled police department during a summons by a judge who oversees the department.

U.S. District Judge Thelton Henderson summoned officials to his court Monday to discuss a report on a sexual misconduct investigation that found fault with the mayor, city administrator, police chief and other top officials.

Assistant city attorney Otis McGee told Henderson the police department agreed with the report’s conclusions and would adopt its recommendations for reform.

Police chief Anne Kirkpatrick, who was hired in January, apologized for the officers’ misbehavior and vowed to clean up the troubled department. She spoke briefly during the one-hour hearing Monday.

Civil rights attorneys Jim Chanin and John Burris called on the judge to launch a deeper investigation into the scandal involving a teenage prostitute and punish senior officers who didn’t act quickly enough.

Henderson said Monday he is optimistic that the department can recover from the sexual misconduct scandal and get back on track and it appears the department is close to complying with all the reforms he ordered as part of 2003 settlement of an unrelated police corruption scandal.

Henderson said he wants to increase the court’s monitoring of the police department, which will be required to report to the court more often on its progress.

Monday’s hearing was the first time in almost five years that the judge has ordered Oakland lawyers to court to discuss problems in the department. Burris and Chanin, who filed the police corruption lawsuit in 2000, said the judge should consider holding the city in contempt of court for its mishandling of the investigation.

The department was close to meeting all of Henderson’s requirements to extinguish court oversight until officer Brendan O’Brien killed himself in September 2015.

O’Brien discussed his relationship with the teenage daughter of a dispatcher in his suicide note and said several other officers were involved with the woman who worked as a prostitute. The monitor and judge were first told of O’Brien’s suicide eight months later and Henderson ordered lawyer Ed Swanson to investigate the department’s handling of the case.

Swanson’s scathing report filed last month concluded that an internal affairs investigation was deeply flawed and superficial and that high-ranking police officials downplayed allegations that several of their subordinates had sexually exploited the teenage prostitute, including when she was 17 years old.

Swanson said detectives treated the victim like a suspect in their only interview with her and that no officers were disciplined. Swanson placed most of the blame on the chief, who he said appeared disinterested in the case and failed to notify the judge, mayor or district attorney about the investigation.

Chief Sean Whent resigned under pressure in June 2016 and the department then cycled through two interim chiefs in less than two weeks before the city administrator took over.

Swanson also faulted the mayor for not keeping close tabs on the internal affairs investigation at the end of last year. Mayor Libby Schaaf said a Dec. 2 fire that killed 36 people in an Oakland warehouse and the search for a new police chief briefly took her attention away from the investigation.

In court papers filed last week, city officials said they agreed the investigation was bungled. But they say the department is getting back on track through a re-organization and the January hiring of reform-minded Anne Kirkpatrick as chief. Kirkpatrick was previously in charge of reforming the Chicago Police Department.

“The recent setbacks have strengthened the city’s resolve to continue to improve the department’s performance and relationships with the community that it serves and protects,” city attorney Barbara Parker wrote in the court filing.

The city has paid the victim almost $1 million to settle her legal claims against the police department. Seven current and former officers face criminal charges.