SAN JOSE, Calif. (KRON/AP) — Dramatic video footage released Wednesday by San Jose police shows a Black man walking around an unmarked police vehicle, opening the door and pointing a gun at an undercover officer inside before the man was fatally shot.

San Jose Police Chief Anthony Mata said two undercover officers in “plain clothes” were investigating an armed robbery and assault incident from March when they fatally shot the man Monday night.

He was identified as 31-year-old Demetrius Stanley.

“Officers did not want, or anticipate, a confrontation that night, and did everything possible to avoid having one. Unfortunately, the officers have no control over the actions of others,” the chief said at a news conference.

Officials released still images of the shooting Tuesday but no details shortly before more than 100 demonstrators marched along the streets and a freeway to protest Stanley’s death.

Family members and some of those who participated in the protest accused police of withholding key details about the shooting. They said home-security video showed the officers were in plain clothes and an unmarked vehicle, and did not announce themselves as police.

One plain-clothes officer was walking on foot on Tofts Drive when Stanley came out of his house and began walking towards the officer while holding a handgun, police said.

The officer heard the sound of a handgun being racked and loaded, then ran away from Stanley as fast as he could.

Mata said neither officer announced themselves as police.

Stanley stopped and tucked the firearm into his shorts, and walked back towards his house. As he walked back, he passed an unmarked vehicle where a second plain-clothes officer was inside.

Stanley originally walked past the unmarked car with his gun tucked in his shorts. He then walked back to the unmarked car and pulled out his gun and opened the driver’s side door.

Video shows Stanley point the handgun at the officer. That’s when the officer shot Stanley, who later died.

The handgun recovered at the scene on the night of the shooting was a 9mm unregistered ghost gun with an illegal high capacity extended magazine.

The undercover officers were not wearing body cameras.

The determination of whether this shooting was lawful and justified will come from the district attorney.

Mata declined to name the officer, a 14-year police veteran, given the nature of the officer’s duties. Police said they recovered a 9mm unregistered ghost gun with an illegal high capacity magazine at the scene.

The protest march was led by the BLACK Outreach SJ and HERO Tent activist groups that protested last spring after the police killing of George Floyd in Minneapolis, and the San Jose Police Department’s violent response to protests in the wake of the killing.

“They’re going to try and say that it was as simple as he pointed guns at police officers, but that’s not what happened,” said Lou Dimes, president of BLACK Outreach SJ. “He was being stalked by people in plain clothing who didn’t identify themselves as police officers. He thought he was in danger.”

The armed robbery officers referred to occurred on March 12.

Police say an incident occurred between Stanley and another person stemming from a road rage incident. The incident was caught on camera by an unidentified witness.

During an exchange outside of their cars, police say Stanley approached the other driver who was a juvenile and pointed a handgun at them. The victim had his hands up over his head.

Stanley then walked over to the juvenile’s car and opened up the center console and took a similar handgun from the car.

A warrant for armed robbery was issued for Stanley’s arrest.

On March 26, deputies with the Santa Clara County Sheriff’s Office located Stanley’s car and issued a traffic stop. Stanley was taken into custody based on the robbery warrant.

During an interview with SJPD, Stanley admitted to the March 12 armed robbery.

Police learned he was not allowed to have a gun due to a previous domestic violence incident.

Stanley was booked into the county jail and bailed out the same day.

A new arrest warrant was issued with new charges including assault with a deadly weapon and possession of a firearm by a prohibited person.

The Associated Press contributed to this report.