Seven current and former Bay Area police officers will be tried for crimes related to contact they had with a sexually exploited teenager, Alameda County prosecutors said Friday as they detailed an investigation that engulfed several police departments and cast the Oakland force into disarray.

Calling the cops’ conduct “morally reprehensible,” District Attorney Nancy O’Malley said charges ranging from oral sex with a minor to misusing computer databases would be filed against five current or former Oakland officers, one former Livermore officer, and one former Contra Costa County sheriff’s deputy.

It’s not clear when the cases — which represent one of the broadest prosecutions of police officers in Bay Area history — will be formally lodged with the courts. Prosecutors now need to make sure the teenager at the center of the scandal, who goes by the name Celeste Guap, is available to testify.

Guap was recently arrested and jailed after law enforcement officials in Contra Costa County helped send her to a rehabilitation center in Florida, where she allegedly attacked a guard. O’Malley said Friday she wasn’t consulted on the cross-country trip and had protested it.

The young woman, who lives in Richmond and has worked as a prostitute, told The Chronicle she had sex with 29 officers in the Bay Area in the past two years, and that her relations with at least four officers occurred before she turned 18. A few officers paid her, she said, while others warned her about antiprostitution stings or ran the names of people she knew through confidential databases.

Some of the most serious charges will be leveled against Ricardo Perez, the Contra Costa County deputy. He resigned in June shortly after Guap told The Chronicle he had sex with her several times last summer in his car off a rural road in Alameda County, when she was 17. Guap turned 19 in August.

Perez, who worked in the county’s jails, will be charged with felony oral copulation with a minor and two misdemeanor counts of engaging in lewd acts in public, prosecutors said.

A Livermore officer who recently resigned, Dan Black, will be charged with four misdemeanors: two counts of engaging in prostitution and two counts of engaging in lewd acts in public, O’Malley said.

Oakland Officer Giovanni LoVerde will be charged with felony oral copulation with a minor, while Oakland Officer Brian Bunton will face a felony count of obstruction of justice and a misdemeanor count of engaging in prostitution.

Oakand Officer Warit Uttapa is to be charged with one count of misusing computer databases, while Terryl Smith, who has resigned, is to face four counts of the same allegation. A retired Oakland officer, Leroy Johnson, will be charged with failing to report sexual misconduct despite being a mandatory reporter, prosecutors said.

Efforts to reach the accused men and their attorneys were not successful.

O‘Malley said many other police officers had contact with Guap, but that criminal charges could not be pressed, in some cases because the men engaged in sexual contact with Guap online, which “the law does not address.”

Additional potential offenses occurred in Contra Costa, San Francisco and San Joaquin counties, O’Malley said, with prosecutors in those counties needing to make their own charging decisions.

Uttapa and Smith, she said, both had sex with Guap in Contra Costa County. On Friday, that county’s chief assistant district attorney, Doug MacMaster, said, “We haven’t been brought any cases that merit the filing of criminal charges.”

Sarai Smith-Mazariegos, who co-founded an Oakland nonprofit that assists child victims of sex trafficking, applauded the charges.

“This is sending a clear message that no matter who you are, what office you represent, if you are exploiting a child, you will be charged and prosecuted,” she said.

While the announcement of the charging decision in Alameda County was a milestone in the case, it was not a culmination.

Several police agencies — including the Alameda County Sheriff’s Office, the San Francisco and Richmond police departments, and the U.S. military’s Defense Logistics Agency — are still weighing whether to fire or discipline numerous officers who had sex with Guap or had other contact with her.

Oakland city officials said Wednesday that four unidentified officers would be fired, seven would be suspended without pay and another referred to counseling after an internal review.

Meanwhile, the Oakland Police Department’s handling of the case in the past year is under heavy scrutiny, and could affect its ability to emerge from federal court oversight more than 15 years after a brutality scandal involving a group of officers known as “the Riders.”

Part of the far-reaching settlement in that case was an agreement that requires Oakland police to inform the district attorney’s office of any incident in which there is probable cause to believe an officer engaged in criminal conduct.

But O’Malley said she only learned of the case in May, about eight months after police supervisors first caught wind of the allegations. As the case unfolded, U.S. District Judge Thelton Henderson shifted oversight of the internal probe to a federal compliance director. And Oakland Police Chief Sean Whent resigned in June.

“We’re not happy and we’re frustrated that the system we put in place to check the police did not work,” said John Burris, one of the civil rights attorneys who secured the settlement. “Police have a history in internal affairs of not policing themselves.”

The charging decision came amid uncertainty over the availability of Guap to testify, after her jailing two weeks ago in Martin County, Fla., on suspicion of battery.

The assistant state attorney in Martin County, David Lustgarten, said he would decide Monday whether to charge Guap after speaking with his supervisor and viewing additional video evidence of the alleged battery. If she is charged with a felony, she could be stuck in Florida for months.

Pamela Price, an attorney representing Guap, blamed Richmond officials for sending her to Florida, likening the action to “witness tampering or obstruction of justice.”

O’Malley said her office had no part in Guap’s trip to Florida. “To the contrary,” she said, “we protested her removal from California where she could receive the services she wanted and requested. An agency outside of Alameda County made arrangements to send her out of state, against our wishes and advice.”

A Richmond police spokesman denied his agency was responsible.

“It’s not our decision,” said Lt. Felix Tan. “We’re glad she got help, but you can’t ever force a victim or anyone into rehab. It just doesn’t work.”

Guap, whose mother is an Oakland police dispatcher, has told The Chronicle that sexual relations with Perez as well as three Oakland police officers occurred before she turned 18. Guap said she had met the Bay Area officers through law enforcement circles, on the streets or through social media.

One of the three Oakland officers Guap said she had contact with as a minor, Brendan O’Brien, committed suicide in September 2015 after leaving a note that referred to Guap. That’s what set off the investigation.

O’Malley, however, said her office’s investigators couldn’t find any direct evidence to confirm Guap had in-person sexual contact with O’Brien.

Guap said she met Perez by sending him a Facebook message after he added her as a friend on the social network. The deputy, she said, would pick her up while off-duty and drive up Fish Ranch Road, off Highway 24 near the Caldecott Tunnel, where they would have sex. She said no money was exchanged.

“I’d say about 10 times,” Guap told The Chronicle. Asked if the deputy knew she was under 18, Guap said, “I don’t think he asked.”

The district attorney’s investigation was based heavily on online communication between Guap and police officers. O’Malley said her office reviewed nearly 150,000 pages of data going back to January 2015 — including nearly 60,000 texts and more than 75,000 Facebook pages and messages.

Kimberly Veklerov is a San Francisco Chronicle staff writer. Email: kveklerov@sfchronicle.com Twitter: @kveklerov