NEW YORK(CBSNewYork) — Suffolk County police have arrested two men in connection with a series of armed robberies that have taken place over the past week thanks to a quick thinking Nassau County Police Officer.

An off-duty Nassau County cop walked into Cool Monkey Desserts on the Nesconset Highway in Stony Brook when store employees told him that two men had just tried to rob the business.

The officer followed the suspects and aided Suffolk County police in apprehending Thomas Leahey, 28, of Ronkonkoma and Joseph Salvia, 25, of Commack.

Both men were charged with three counts of robbery in connection with incidents at the Tropical Smoothie Cafe in Elwood, a Subway sandwich shop in Happague, and at Beach Bum Tanning in Commack.

The men were also charged with three counts of attempted robbery in connection with incidents that took place at Cool Monkey Desserts, a Quiznos in Bohemia, and a Dunkin Donuts in Smithtown.

The men were scheduled to be arraigned at the First District Court in Central Islip on Tuesday.