A retired NYPD detective said he was forced to pull out his gun when a bat-wielding man confronted him on a New York City subway. 

The tense moment, which took place Wednesday morning on the G train at Greenpoint Avenue, was captured in a now-viral video. The cellphone footage shows NYPD veteran David Morales arguing with Brian Baksa, a 40-year-old man who authorities say is homeless. Morales is seen holding his pistol while demanding Baksa to "stay where you're at."

Baksa, who had a wooden bat and a bag in his hands, is heard shouting: "Respect my fucking bag! You’re threatening me!"

"What you don’t see in the video, he did take the bat out and he did put it behind his back for a swing … so when I took out my revolver that's when he decided not to swing," Morales told CBS 2. "Apparently my bag must have touched his bag and he must have been having a really, really bad day, and he erupted. I could see he had some issues. I don’t know what they were, but he was really angry."

Baksa got off the train at Clinton-Washington Avenue station, where he was placed under arrest. He is now facing charges of second-degree menacing and fourth-degree criminal possession of a weapon. 

According to CBS 2, the retired detective is licensed to carry the gun as he is now an investigator for the Administration of Children's Services. The NYPD Transit praised Morales for the way he handled the situation. 

Morales was not charged.