Mr. de Blasio has been dogged since the start of his mayoralty with balancing the demands of his allies and constituents on the left, who want to revamp the Police Department and reduce incarceration, and the possibility of a revolt among rank-and-file officers angry about progressive criminal-justice policies.

He ran as a candidate critical of stop and frisk, a tough-on-crime tactic which critics said had been misused to unfairly target people of color. Then the death of Eric Garner, who died during an arrest on Staten Island in 2014, prompted angry protests against the police.

Months later, two officers were killed by a man who traveled to the city to attack the police. Officers turned their backs on the mayor at the funerals, as union leaders said the mayor’s rhetoric was partly to blame. The events rattled Mr. de Blasio.

The mayor still vowed change, but also supported budget increases and policing strategies that civil liberties advocates and public defenders said unfairly targeted black and Hispanic New Yorkers.

The rapid selection of Mr. Shea, the chief of detectives and a veteran of the Police Department who has been integral to its operations for years, was the third time that he had reached past high-ranking candidates of color for a white official.

“It’s a terrible message that’s being sent,” said Jumaane D. Williams, the city’s public advocate. “For an administration that says they want to do things differently, I don’t know that it’s really explainable.”

Robert E. Cornegy Jr., a City Council member from Brooklyn, agreed. He said Mr. Tucker was the official whom he would consult to discuss diversity in the Police Department or fair policing.