It was after midnight at the Mile High Spirits bar near downtown Denver, and things were going well for the man in the middle of the dance floor.
Patrons surrounded him and women smiled at him, some with their phones out, as he showed off his freestyle dance moves.
Then, he swung his arms back and squatted, as if to prepare for his next big move. He jumped up, arching his back and swinging his arms above his head.
But as he was about to land his backflip, a gun flew out from his holster at the back of his pants. He landed and as he picked up his gun from the floor, it fired.
He tucked his gun back into his holster and walked away from the dance floor, raising both his hands.
Patrons began to scatter, and the women who had been smiling at him just seconds earlier stared, a look of open-mouthed shock on their faces.
The incident, which occurred at 12.45 am local time at the weekend, was captured in a 32-second video obtained by ABC affiliate KMGH.
The man was an off-duty FBI agent, according to the Denver Police Department, which did not identify him.
He accidentally fired his gun as he was picking it up from the floor, striking another bar patron in the lower leg, police said.
That patron was taken to a hospital and is in good condition.
Denver police spokesman Marika Putnam said she does not know what type of gun the agent was carrying.
The police department's homicide unit is investigating the incident, and the Denver district attorney's office will decide on criminal charges, if any.
Special Agent Amy Sanders, spokeswoman for the FBI's Denver field office, said the agency cannot provide details, citing personnel matters.