Prosecutors have not charged a man who allegedly shot another man in the head on board a subway train in Brooklyn Thursday, saying there is evidence he acted in self defense.

In a statement released Friday afternoon, a spokesman for the Brooklyn district attorney’s office called the shooting “shocking and deeply upsetting,” but said no charges have been filed in connection with the incident. 

“The investigation into this tragic incident is ongoing but, at this stage, evidence of self-defense precludes us from filing any criminal charges against the shooter,” the spokesman said. 

Police said a 32-year-old man shot a 36-year-old man in the head on board a northbound A train at the Hoyt-Schermerhorn Streets station during the Thursday afternoon rush.

The shooting happened after a dispute between the two men escalated, according to police. 

Police said a woman who was with the 32-year-old man was also involved. 

“It looks like she had a sharp object and cut the 36-year-old male with that sharp object," NYPD Chief of Transit Michael Kemper said.

At some point during the dispute, the 36-year-old man pulled out a gun, but the 32-year-old man disarmed him, firing multiple rounds inside the subway car with the gun and striking the 36-year-old man in the head, the NYPD said. 

The 36-year-old was hospitalized in critical condition, and the 32-year-old was taken into custody after the incident, police said. 

During an appearance on “Mornings On 1” Friday, Mayor Eric Adams said the incident appeared to have involved a person with “severe” mental health issues, without providing details. 

“I don’t want to go into the thrust of the investigation, but I’m sure as New Yorkers see this unfold, and what we can release, you would see there was a passenger that was merely just minding his business and going, you know, using the transportation like millions of people do, and a person with severe mental health illness, what appears to be severe mental health illness, got engaged in a very violent way,” Adams said. “But the investigation’s going to take its course.”

According to police, they are still looking for the woman.