A man fatally shot another man who was trying to rob him Wednesday night in the Bronzeville neighborhood on the South Side, police said.

The 22-year-old man was sitting in a vehicle with another male about 8:20 p.m. in the 4300 block of South State when two males armed with handguns walked up and announced a robbery, according to Chicago Police.

The man then pulled out a gun and shot one of the would-be robbers in the head, while the other suspect ran away, authorities said.

Treamel Gray, 23, was pronounced dead at the scene at 8:35 p.m., the Cook County medical examiner’s office said. He lived in the 18900 block of Avers Avenue in Flossmoor. An autopsy Thursday ruled his death a homicide.

The 22-year-old man had a valid concealed carry license, according to police. No one else was injured in the shooting.

Police said no charges will be filed in connection with the shooting.