In a statement released late Thursday, Chief Sean Whent said that he had worked to make the city safer by forging better ties with its diverse communities, and that the vast majority of Oakland officers shared that commitment.

He gave no reason for stepping down.

Whent made his own decision about leaving the job, Mayor Libby Schaaf told reporters Friday. Schaaf did not explain the chief's sudden resignation, but thanked Whent for "incredible strides to rebuild trust in the department" during his two-year tenure.

The historically troubled Oakland department currently is investigating allegations that several officers had sex with an underage girl.

Two officers have resigned and two others remain on paid leave because of the underage sex scandal. Another officer, Brendan O'Brien, committed suicide. The girl is the daughter of an Oakland police dispatcher.

Prosecutors still are reviewing the police department's initial investigation of the allegations, Schaaf said.

Oakland police have been under supervision of monitors appointed by federal courts since 2003. The supervision stemmed from a civil settlement involving allegations that four night-shift officers in predominantly black west Oakland were beating and robbing residents and planting evidence.

The monitors since have faulted department managers and internal investigators for allegedly failing to hold officers accountable for misconduct.

Whent became chief in May 2014 and is being replaced by Ben H. Fairow, deputy police chief at the regional transit system. He will be the Oakland department's fifth chief since 2009.