Two men have confessed to stealing, and then returning, a painting by Gustav Klimt in a bizarre twist to one of Italy’s most mysterious cases of stolen art.

Experts confirmed on Friday the authenticity of Portrait of a Lady, which was found concealed in a wall of the Ricci Oddi modern art gallery, the same gallery in Piacenza from which it went missing almost 23 years ago.

Police questioned two men, believed to be part of a gang involved in dozens of thefts in the northern city and surrounding area, for hours on Friday after they declared themselves the perpetrators of the 1997 crime in a letter to Ermanno Mariani, a journalist for the local newspaper, Libertà.

Mariani, who first came into contact with one of the men when he was being tried for a burglary several years ago, received the letter after two gardeners discovered the painting as they cleared ivy on an exterior wall of the gallery in December. The gardeners spotted a metal panel behind which there was a cavity with a painting in a bag.

In their letter to Mariani, the men said they had stolen the painting – valued at €60m – in February 1997, and claimed they had returned it “as a gift to the city”.

One of them had originally confessed to Mariani three years ago, asking the journalist to set up a meeting with investigators.

“They said they returned the painting four years ago,” Guido Gulieri, a lawyer for the pair, told the Guardian. “But we don’t yet know the details of how it came to be [in the recess] and what exactly happened to the painting in the intervening years. They had confessed before but were not believed.”

The men have given police the address of a house where they claim the painting had been stored, Gulieri added.

Mariani said: “They have been obscure about the details but have always maintained that the painting was not in the cavity all of that time. I’m not a technical expert, but it would have been damaged if it had been there for all those years.”

Portrait of a Lady went missing during preparations for an exhibition in Piacenza aimed at showing it off, after the revelation that it was the only “double” Klimt known to the art world. The discovery was made by an art student who realised it had been painted over another Klimt piece previously believed lost – Portrait of a Young Woman, which had not been seen since 1912.

Police believe the thieves used a fishing line to hook the painting off the wall and haul it up through an open skylight to the roof of the gallery, where the frame was discarded.

While the intricacies of the crime are unclear, the motive for confessing are more transparent. The pair made their first admission 20 years after the theft, meaning they would avoid prison as the statute of limitations for the crime had expired.

The painting was also found weeks before Italy’s high court was due to hand down jail terms for another theft, and so it is thought the men were hoping to be granted leniency by confessing to stealing Portrait of a Lady. There is speculation that the men had been planning to reveal its location, only to have been beaten to it by the gardeners.

Investigations are ongoing, but Gulieri believes that their claims are true. “It is a very strange story … they could have sold it or burned it, or whatever,” he said. “They won’t go to prison for it. But the good news is, we have found the painting.”

Mariani said the theft bore similar traits to some of their past crimes, for example the robbery of 300 illuminated manuscripts from Piacenza’s Passerini-Landi library in 1984.

“The thefts were carried out in a similar way – the library was undergoing restoration works and so the manuscripts could be removed easily,” Mariani added.

Until December, Portrait of a Lady was the second most sought-after painting in the world after Caravaggio’s Nativity with St Francis and St Lawrence. The Caravaggio painting was stolen in 1969 from the Oratory of San Lorenzo in Palermo and its theft is considered one of the greatest mysteries in art history.