For the first time since the fatal shooting of African immigrant Amadou Diallo by four white cops, an NYPD officer has been charged with second-degree, or intentional, murder in an on-duty shooting. Again, the shooting occurred in the Bronx. Again, the officer was white. Again, the victim was black.

The city may have changed in the nearly 18 years between the incidents, with a progressive mayor whose political base consists largely of black New Yorkers. And the shootings’ details are different. Still, relations between blacks and the police remain tense.

Sgt. Hugh Barry was indicted last week after fatally shooting Deborah Danner, a black, 66-year-old, emotionally disturbed woman who police say attacked him with a bat. Cops were alerted to her apartment by neighbors who heard her screaming.

The shooting in October — just a month after James O’Neill became commissioner — was fraught with controversy. Before the investigation was completed, O’Neill placed Barry on modified assignment, citing his poor tactics — not waiting for emergency service officers and not first using his Taser instead of his gun.

O’Neill issued a statement: “We were called to that apartment to help someone . . . and we ended up killing her.” A few hours later, Mayor Bill de Blasio said, “Deborah Danner should be alive today. Period.” Bronx District Attorney Darcel Clark did not grandstand, forgoing the standard DA news conference in announcing the indictment, which also included manslaughter and criminally negligent homicide charges.

Yet how can the intentional murder charge be viewed as anything but grandstanding? The law states an officer can use deadly force if he feels his life is threatened.

In 2000, the cops who shot Diallo were acquitted by a jury after an appeals court removed the case to Albany. The trial jury accepted the cops’ argument that anti-cop Bronx jurors might automatically find them guilty. Many blacks viewed the removal and acquittal as racism. Many cops saw it as justice.

If at trial Bronx jurors find Barry guilty of murder, an appeals court might eventually reverse it. Again, many blacks might see the reversal as racism. Once again, many cops will see it as justice.