With police officers literally turning their backs on his boss, NYPD Commissioner William J. Bratton faces a daunting task in trying to bridge the gulf between a mayor who campaigned on revamping department practices and a rank and file alienated by Bill de Blasio's words and actions.

Add to the mix heightened tensions from anti-police brutality protests and the Dec. 20 assassinations of Officers Rafael Ramos and Wenjian Liu, and Bratton is very much the man in the middle. It's a balancing act that will call on all of his nearly four decades as a cop.

De Blasio, say policing and political experts, is more dependent than ever on Bratton and the loyalty he retains throughout the ranks of the 35,000-member department.

Eugene O'Donnell, a former police officer and now a professor at the John Jay College of Criminal Justice, said Bratton's reputation, experience and words resonate with street cops because he had been one of them.

"He understands what the police do, and he doesn't pander, and that's a very persuasive thing for the street officers, because they know he gets their work," O'Donnell said. "No doubt the situation would be even more precarious if Bratton was not there, because Bratton is a heavyweight in the police world -- not the bureaucratic or political police world -- but in Copland, where cops are out there taking the risk."

When he led the Los Angeles police between 2002 and 2009, Bratton earned the respect of longtime critics of a force long dogged by corruption and instances of brutality and racism. When he left, his record was praised by such unlikely sources as the local American Civil Liberties Union branch.

Bratton's importance as the public face as well as the chief executive of de Blasio's policing policy stands in sharp contrast to his first tour at 1 Police Plaza, when Mayor Rudy Giuliani ousted Bratton amid a clash over claims of credit for a dramatic crime drop.

Bratton now works for a mayor who won his office on a promise to repair the fraught relationship between the NYPD and minorities, particularly on the practice of stopping, questioning and frisking mostly black and Hispanic men, most of whom had done nothing wrong. At the same time, he has a mandate to maintain the historic crime reduction that began in the early 1990s.

"If anyone can walk this tightest of tightropes, it's Bratton," said Mark Green, who would have made Bratton his commissioner had Green beaten Mike Bloomberg in the 2001 mayoral race. "Why I would have wanted Bratton then is what I assume the reason that de Blasio wants -- and needs -- him now: he's enormously, capably experienced, and that's a useful combination with a proudly progressive mayor," said Green, a Democrat.

Bratton's tenure has seen the rise of the protest movement over civilian deaths by police, including the death on Staten Island of Eric Garner in July -- anger further inflamed when a grand jury declined to indict the officer who apparently used a banned chokehold on Garner. Amid the uproar, de Blasio infuriated police unions by recounting how he warned his biracial son "in how to take special care in any encounter he has with the police officers who are there to protect him."

The Patrolmen's Benevolent Association, which represents the rank and file, responded by circulating form letters to its members telling the mayor not to appear at their funerals if they die in the line of duty. Then, after Ramos and Liu were slain, union president Patrick Lynch said de Blasio had blood on his hands.

Eric Adams, a former city police captain and now Brooklyn borough president, noted that even as the unions ripped into de Blasio, the mayor's hand-picked police commissioner has escaped their wrath.

"I don't think you've heard them bring up his name at all," said Adams, who once led the Guardians, a black NYPD officers group.

Indeed, while hundreds of officers turned their backs on an image of de Blasio at Ramos' funeral, Bratton's poignant eulogy received thunderous applause from mourners.

Ramos, he said, "represented the blue thread that holds our city together when disorder might pull it apart."

An official who works for Bratton said that de Blasio and Bratton have a good working relationship and that the commissioner genuinely feels that de Blasio is the best mayor he has had to work with. Bratton has said that whatever he has asked for in terms of money and resources for training and technology de Blasio has given him.

"He [Bratton] asked the guy for $130 million and he got it," said the official, who didn't want to be named. But, the official added, "The problem is with the mayor and the unions." As a result, Bratton finds himself in the middle, trying to keep the rank and file happy.

Bratton, not de Blasio, was in the spotlight again on "Face the Nation" and "Meet the Press" on Sunday.

"Morale in the department at this time is low," Bratton acknowledged -- a predicament he blamed on numerous factors, including the PBA's lack of a labor contract.

If continued tensions lead to less energetic policing, the NYPD's effectiveness could suffer, experts said.

"A sufficiently bad relationship between the police force and the mayor ends up hurting the city pretty badly," said Daniel Feldman, a John Jay professor and former state assemblyman. Keeping crime rates down is vital to the city's continued economic prosperity, he said.

The gulf between the mayor and police was clear to leaders of other police forces who came to New York for Ramos' funeral.

Speaking outside the church after the backturning episode, Chicago police superintendent Garry McCarthy said, "If anybody can fix what's happening here, it's going to be Bill Bratton. He's an incredible professional."

With Anthony M. DeStefano and Darran Simon