Homicide detectives on Friday were hunting for a trio of thieves in the ​murder of an Upper West Side shopkeeper — whose blood-drenched corpse rotted for hours behind a counter before it was discovered, law enforcement sources said.

The​ suspects were seen on surveillance video loitering outside BNC General Merchandise on Amsterdam Avenue near West 104 Street around noon — with the front ​door wide open, law enforcement sources said.

The footage showed them walkin​​g in and out of the store, and then “acting suspiciously” while standing in front of the place, a law enforcement source said.

The suspects then strolled away, apparently with stolen property, heading to the subway station on Broadway and West 103 Street, the source said.

Two hours later, Bubacarr Camera, 26, of The Bronx, was found dead in a pool of blood behind the counter by his cousin, who had searched the store for 20 minutes before making the grim discovery, sources said.

Camera had suffered what appeared to be two head wounds — one to the back and the other to the left side, sources said.

Investigators believe he was either shot or stabbed during the robbery, sources said.

The store was in disarray with coins from the register scattered about the counter, sources added.

Surveillance video showed Camera opening the store around 9:30 a.m., with only a handful of customers entering and leaving before the suspects arrived around noon, sources said.

After the thugs fled, several more shoppers were seen on the video with “bewildered looks” after exiting the store because they believed the shop had been left unattended, sources said.

Anyone with information on the suspects is urged to call CrimeStoppers at 1-800-577-TIPS.