Sometimes police need to be creative in how they subdue a suspect — and have to use only the tools available to them.

Youngstown, Florida police received a call that an armed man was in the Rainbow Food Store last week. When they arrived, they allegedly found 25-year-old Justin Tyler Stanford wielding a hammer.

Sheriff Tommy Ford, Deputy Chief Joel Heape and Maj. Jimmy Stanford confronted Justin Stanford, and video shows Maj. Stanford pelt the distracted suspect with two cans of baked beans, the Panama City News Herald reports.

The moments were tense inside the grocery store.

Heape said the suspect “came toward me and takes a swing at me with the hammer and I blocked the swing and hit him with the butt of the gun and that knocked him back into a tray of lotion or something, it went everywhere.”

Heape said the sheriff was trying to get the man calmed down, but, “Then he just suddenly went crazy again and when he raised the hammer, Jimmy went on his bean attack.”

“I saw Jimmy poke his head out, the next thing I know he steps out with a can of Bush’s extra brown sugar baked beans and hits the suspect in the upper body and distracts him,” Bay County Sheriff Tommy Ford said, according to Fox 8.

The video shows Stanford’s throw was a direct hit, causing the suspect to turn towards him.

“And then he does it again and the suspect … Joel was able to deflect his swing and lock his arm up. It was a fight, we were wrestling.”

“My thoughts were I could take these and hit him with them and they’re not going to kill him, a less lethal alternative,” Stanford told the paper. “And it should get his attention diverted away from the sheriff and the chief and they could apprehend him.”

Fox 8 reports Justin Stanford was “arrested and charged with assault with a deadly weapon on an officer, resisting arrest with violence, DUI and leaving the scene of an accident with damage.”