The NYPD released body-cam footage Friday depicting the events that led to a fatal police shooting of a mentally ill man who attacked an officer with a metal chair.

The incident happened at a Brownsville nail salon around 5:30 p.m. on Oct. 25, 2019, after cops were called to the location for a report of someone urinating inside.

Officer Lesly Lafontant and his partner Officer Joseph Leon entered the salon and began speaking to the man, who became aggressive and started shouting at workers, calling them “bitch” and demanding to see their “green card,” the video shows.

“Shut the f–k up bitch, you’re not even American,” the man yelled as Lafontant and Leon tried to arrest him.

The man violently resisted the arrest and as the two cops were struggling to put cuffs on him, a T-shirt vendor outside of the store, 33-year-old Kwesi Ashun, burst into the store and attacked Lafontant, the video shows.

Ashun, who’d been outside hawking his own hand-embroidered wares, punched Lafontant in his face when the arrest started to get physical between the public urinator and the two officers, the video shows.

“Seemingly, without provocation, the suspect began to assault Officer Lafontant by repeatedly striking him in the face with his fist. As Mr. Ashun continued to punch Mr. Lafontant, Officer Leon discharged his taser at the subject,” a police spokesman says in the video before it’s played.

“The prongs struck Mr. Ashun in the lower left side of his back but the taser was ineffective in stopping the subject. The subject then picked up a steel chair and struck Officer Lafontant with it several times causing serious physical injury.”

Approximately 12 seconds later, Lafontant used his service weapon and fired six rounds at Ashun, police said. Four bullets struck the man, killing him, cops said.

Much of the attack, including the actual shooting, wasn’t clearly captured on camera, but Leon’s body-cam captures a brief glimpse of a man wearing a hat come into the salon and attack Lafontant. His body camera had been shut off, “possibly” because of physical contact he had during the arrest attempt, police said.

Leon’s camera shows the start of the attack before his camera is knocked to the ground. The NYPD cut off the sound in the video briefly, but turned it back on just before two shots from Lafontant’s service weapon rang out in the salon as horrified nail-workers shrieked.

Lafontant, a 21-year veteran of the force, suffered “facial fractures and lacerations” from the melee and was later placed in a medically induced coma at Brookdale Hospital before he was released three-days later.

Ashun was pronounced dead at the scene.

It later emerged that Ashun was suffering from bi-polar and schizophrenia disorder and both he and his family had asked the city’s embattled Thrive NYC program for help, 11 days before his fatal interaction with police.

“He struggled with mental illness, and we tried desperately to get help for him to no avail,” his sister, Ama Bartley, 35, told The Post at the time.

She said he’d recently been pushed to the edge after his father moved to a nursing home.

Ashun had an Oct. 14 appointment with a mobile crisis team from the city Department of Health, but health workers determined after a short visit that he was not a threat to himself or others, she said.

A day after the incident, Mayor Bill de Blasio said he would investigate what went wrong. It was not immediately clear if that investigation had finished.