OAKLAND — Sean Whent has resigned as Oakland’s police chief, city officials said late Thursday.

Whent, who has spent his entire 20-year career with Oakland police, will be replaced by Interim Chief Ben Fairow, who returns to the department after serving as deputy chief of BART police.

Whent’s departure comes amid an investigation of sexual misconduct involving police officers and a police dispatcher’s daughter, which has upset Oakland Mayor Libby Schaaf.

“I am so proud to have served Oakland over the course of my two decade-long career,” Whent said in a statement issued from Schaaf and City Administrator Sabrina Landreth. “When I took this job three years ago as interim chief, I vowed to help move the department forward and make Oakland safer by forging a stronger relationship with members of this diverse community. I am proud to have done that.”

Whent did not answer his city-issued cellphone late Thursday.

The statement from Schaaf and Landreth said Fairow is “on loan” from BART police as they conduct a national search for a new police chief. Whent was Oakland’s fourth police chief since 2009. The city said Fairow will appear at a news conference at 9 a.m. Friday at City Hall.

Whent, a Brentwood resident, was named by then-Mayor Jean Quan to replace Howard Jordan, though the monitor who oversees the department has input as to who stays and who goes.

Whent grew up in Pleasanton, the son of two Oakland natives and when he was named interim chief in 2013 he recalled listening to Oakland’s police scanner as a young boy while he stayed at his grandmother’s house in the San Antonio district.

He graduated from Oakland’s police academy in 1996 and spent most of his early years as a beat cop and in 2003 he won department’s Medal of Valor for rescuing a woman from a burning Ford Mustang that crashed after the driver was involved in a crash during a late-night “sideshow.”

Before becoming chief, Whent spent years in the department’s Internal Affairs Division, responsible for holding officers and staff accountable if they violated department policy. But he faced criticism then from some officers who said his investigations were sometimes dishonest and that discipline was uneven.

Internal affairs has come under questioning recently after Officer Brendan O’Brien killed himself in September and left a note naming officers who were involved with the daughter of a dispatcher who goes by the name Celeste Guap. Two officers have resigned in the wake of the scandal and two others remain on paid administrative leave.

One police department observer, Rashidah Grinage of the Coalition for Police Accountability, shared her surprise at the announcement late Thursday.

“It’s a little ironic that scandal seems to have more weight than police-involved shootings. One has to wonder to what degree this is political as opposed to something more analytical. It’s very hard for me to understand. I tend to wonder what is going on, where the pressure is coming from.”

Grinage pointed to San Francisco’s recent replacement of Chief Greg Suhr with acting chief Toney Chaplin as one example of transition: “Usually it’s an assistant chief or someone on the command staff while a national search is taken. It’s definitely a departure.”

Staff writer Matthew Artz contributed to this story. David DeBolt covers Oakland. Contact him at 510-208-6453. Follow him at Twitter.com/daviddebolt.