Oops.

A repeat felon was arrested at a Dunkin’/Baskin Robbins shop in Brooklyn on Sunday after a gun fell out of his pants and onto the floor in front of a group of New York police officers.

TACO BELL EMPLOYEE TRASHED OFFICE, THREATENED CO-WORKERS AFTER GETTING FIRED

According to a tweet from NYPD Transit, three cops were at the chain when a man walked in and adjusted his pants, causing the loaded gun to fall through his pant leg. The police officers saw the gun on the ground and arrested the man, stating he was a “repeat felon.”

CLICK HERE TO GET THE FOX NEWS APP

In a video shared by a Twitter user, security footage shows the man walking in before immediately seeming to drop the gun. Two police officers are then seen arresting the suspect while another officer appears to pick up the gun and magazine.

FOLLOW US ON FACEBOOK FOR MORE FOX LIFESTYLE NEWS

The officers attributed the incident to a transit cop’s “craving for cake batter ice cream.”

The man was taken into custody.