NEW YORK (AP) — On the CBS documentary series “Brooklyn DA,” the story line is simple: Can prosecutors put the bad guys away?

Behind the scenes, the drama unfolding at one of the nation’s largest district attorney’s offices is more complex, with an upcoming election and opponents threatening to unseat the longtime leader, a review of dozens of cases and a federal lawsuit by a man who was wrongfully convicted.

“I think there is definitely some damage control going on,” said Alex Vitale, a Brooklyn College political sociology and criminology professor. “But it’s important to keep in mind it’s a huge staff. I don’t think it’s fair to say there is some kind of crisis in the day-to-day at the DA’s office.”

In Brooklyn, Charles “Joe” Hynes is a ubiquitous figure with a tough-on-crime persona that has won him diverse fans — and critics — throughout the borough. His office sees more than 1,500 new cases a week and handles more than 80,000 per year.

Hynes has gone further than most prosecutors with community outreach. He’s created alternative-to-incarceration programs, a gun buyback program replicated citywide and a family justice center where victims of abuse can seek refuge and get help — in several languages.

“The guy is known nationally for being innovative. He is someone who will work and mentor and help others,” said Scott Burns, the president of the National District Attorney’s Association. “He is somebody who we think gets the big picture — it’s not about convicting someone, it’s about serving your community.”

Hynes, 78, has been the Brooklyn district attorney for the past 23 years. He ran unopposed in 2009, but is being challenged in this year’s Democratic primary on Sept. 10.

The six-part documentary about his office airs nationally on CBS and online, with the next episode airing June 22. It tracks prosecutors and cases that deal with sex trafficking, an art heist sting and the shooting death of New York City police Officer Peter Figoski in a botched robbery in 2010. Hynes rarely appears on air, and his prosecutors don’t win every case.

In one episode, a prosecutor frets over whether a trap set for an accused art thief will fall through because the hidden cameras might be visible. In another, a homicide prosecutor frankly discusses a disappointing jury verdict.

Some cases on the documentary are mid-investigation, prompting some criticism by other prosecutors and defense attorneys who say they could be compromised by the undue publicity. But Michael Vecchione, head of the rackets division and a confidant of Hynes, insists the office took great pains not to jeopardize any cases.

“I think it’s wonderful because it actually shows what an assistant district attorney goes through and how the job affects our lives,” said Vecchione, who figures heavily into the show.

Susan Zirinsky, a senior executive producer at CBS overseeing “Brooklyn DA,” said every effort was made not to disrupt the legal process in the cases they featured — and she emphasized that the network had no intention of influencing the local race.

“It wasn’t about the election,” she said. “We’re a national program. I don’t think in Des Moines, Iowa, they know that Joe Hynes is running for DA.”

The network says it came up with the idea of the show and approached Hynes about it last fall.

Not surprisingly, Hynes’ opponents hate the show. An attorney for DA candidate Abe George called it “nothing more than unabashed campaign puff-piece for Hynes, his office, and Michael Vecchione.”

George took the network to court to get the show shelved on the grounds it was campaign propaganda that violated state laws on corporate donation limits. A Manhattan judge denied the request after hearing testimony from CBS executives and reviewing copies of emails they exchanged with Hynes’ office.

Attorney Joel Rudin now wants to look at those emails in the hope that they may help build a high-stakes civil case for his client, Jabbar Collins, whose murder conviction was overturned in 2010 after he spent 16 years behind bars in the 1994 killing of a rabbi and landlord in Brooklyn.

In a $150 million lawsuit, Collins said the investigation — led by Vecchione — didn’t turn over exculpatory documents, coerced witnesses and often held them against their will in hotel rooms. The office denied all wrongdoing.

“They’re all allegations; none of them are true,” Vecchione said. “The office has said a thousand times, not one single thing they said about me is true.”

Hynes was ordered by a judge to give a deposition in the case.

He also recently ordered a review of more than 50 cases handled by a now-retired detective after a conviction was overturned and questions came up about the reliability of a drugged-out witness used in many of the cases. Ken Thompson, a former federal prosecutor who’s also running for the office, has asked Gov. Andrew Cuomo to name a special prosecutor to do that review instead.

Thompson represented the maid at the center of the 2011 sex assault scandal involving former International Monetary Fund leader Dominique Strauss-Kahn. The criminal case against Strauss-Kahn fell apart over questions about the maid’s credibility, but a lawsuit was settled privately last year.

“If District Attorney Hynes spent less time worrying about reality TV and more about delivering justice to victims, his office’s reputation wouldn’t be tarnished by a pattern of wrongful convictions and allegations of prosecutorial misconduct,” he said.

But Burns of the district attorneys association, who is unrelated to the campaign, said there has been a national movement to encourage prosecutors to create conviction integrity teams. Some have been reticent to do it, but not Hynes.

“Joe Hynes has been at the forefront of that and for whatever reason they also come under intense criticism. It’s kind of a damned-if-you-do, damned-if-you-don’t position,” he said.

Vitale said it’s unlikely Hynes will be unseated, but there is a growing desire in the borough for fresh blood in the office.