A Greek man has been accused of the bungled theft of a Salvador Dalí work from a New York gallery, taking the painting as security cameras rolled and later, in a panic, posting it back.

Phivos Istavrioglou left fingerprints that helped detectives track him down – another misstep in a botched caper that even he found foolish, according to an account of a confession in court papers.

As soon as Istavrioglou left the Upper East Side gallery last summer with the Dalí watercolour , he was "scared and couldn't believe what a stupid thing he did", the papers say.

Istavrioglou, 29, from Athens, pleaded not guilty on Tuesday to grand larceny during a brief court appearance in Manhattan where a judge set bail at $100,000 (£65,000).

Prosecutors accused him of stealing the painting, Cartel de Don Juan Tenorio, in broad daylight while visiting New York. After pulling it off the wall, he stashed it in a shopping bag and flew back to Athens with it, authorities said.

"It was almost surreal how this theft was committed – a thief is accused of putting a valuable Salvador Dalí drawing into a shopping bag in the middle of the afternoon, in full view of surveillance cameras," the district attorney, Cyrus R Vance Jr, said.

Shortly after learning authorities had distributed security photographs of him that were seen around the world, Istavrioglou took the $150,000 work out of its frame, rolled it up in a cardboard tube – "in a manner befitting a college dorm poster" – and mailed it back without a return address, prosecutor Jordan Arnold said.

New York police department detectives lifted fingerprints from the shipment that matched one from a juice bottle that they say Istavrioglou shoplifted last year from a Whole Foods market, giving them a name, said the police commissioner, Raymond Kelly. An investigator posing as an art gallery owner tricked Istavrioglou into returning to New York by offering him a possible position as a consultant.

Federal agents intercepted Istavrioglou at John F Kennedy international airport last Saturday. While speaking to detectives that afternoon, court papers say, he "indicated he knew the theft would catch up to him and wants to make [the] situation right".