FBI
This is a representational image showing an FBI agent at the First Baptist Church of Sutherland Springs, Texas, Nov. 7, 2017. Reuters/Jonathan Bachman

An off-duty FBI agent's gun came loose when he was showing off his moves on the dance floor of a Denver nightclub Saturday. During an improvised backflip, the handgun fell from the agent's waistband holster and a shot was fired, injuring another clubgoer.

A video obtained by ABC affiliate KMGH, shows the unidentified officer dancing at the Mile High Spirits Distillery and Tasting Bar in Denver. People are seen surrounding the man as he dances wearing a blue shirt and tan pants.

There's no music in the video, but it's evident the man was having a good time as he grooved to the rhythm. At one point, the man did the backflip during which the gun came loose and as he scrambled to get the gun, a round went off.

The agent quickly placed the gun back in its holster, held his hands up and walked off the dance floor. Members of the crowd appeared shocked after the gun fired.

According to the Denver Police Department, the stray bullet struck another man in the leg, who was taken to the hospital. The injured man is in good condition, police said. The department also said the incident is being investigated to determine if the off-duty officer will be charged in the case.

"The incident is being investigated by the Denver Police Homicide Unit and charges will be determined by the Denver District Attorney’s Office," the Denver Police Department said in a statement.

"He's potentially in trouble for a number of potential violations, administrative and otherwise, so this is a great example of clearly, what you should not be doing if you're armed," former FBI special agent Brad Garrett told ABC News.

Authorities are awaiting results of blood tests to determine whether the FBI agent had been drinking, and if alcohol was a factor in the incident, according to CBS Denver. They are also reviewing the videotape of the incident.