A doodle of a man’s head unseen for more than 500 years has helped to persuade experts that a painting in the national museum of Wales is almost certainly a genuine Botticelli.

National Museum Cardiff has put on display a painting of a Madonna and child that had for decades been dismissed as a crude copy of Botticelli’s style.

Ironically, it had been thought a Botticelli by the collector, Gwendoline Davies, who bequeathed it in 1952. Experts soon began to doubt that and downgraded it to the status of copy.

The story of the rediscovery has been documented in an episode from the BBC Four series Britain’s Lost Masterpieces, which features a team of art detectives led by the art historian Bendor Grosvenor.

Madonna and child, now confirmed as almost certainly a genuine Botticelli. Photograph: BBC/PA

He recalled seeing the painting in the museum store and being struck by the “extraordinary beauty” of the Madonna’s face.

“Despite all the overpaint, parts of it reminded me of Botticelli’s most famous painting, The Birth of Venus. I’m now convinced that Botticelli played an important part in its production, and am delighted it has once more gone on public display.”

It was cleaning and analysis by the conservator Simon Gillespie that revealed the remarkable quality of the painting.

Infra-red photographs showed under-drawing typical of Botticelli’s studio, together with numerous changes in areas like the hands, proving that the painting was not a simple copy.

Also revealed was a doodle almost certainly by Botticelli – a profile drawing of a man’s head made before the painting was finished.

Gillespie discovered that the arched background was the work of a forger, added in the early 20th century, probably to hide the fact that the painting had been significantly reduced in size from a larger work. It has been decided to keep the added background to reflect the painting’s history.

Gillespie said the work had been both nerve-racking and thrilling. “We had to proceed millimetre by millimetre, given the fragility of the panel and the original paint layers. Removing the dirt and old varnish to reveal the true beauty of the Madonna’s features felt like witnessing the rebirth of a masterpiece.”

Infra-red photographs showed under-drawing typical of Botticelli’s studio, together with numerous changes in areas like the hands. Photograph: BBC/PA

The museum has also been involved in the research and conservation.

Adam Webster, chief conservator at National Museum Wales, said the project showed the crucial role conservation plays in the proper understanding or our heritage. “We are delighted with and grateful for the results. The painting now sits beautifully in our galleries and I hope fans of the series will come and enjoy this masterpiece.”

Laurence Kanter, chief curator of Yale University Art Gallery and an expert in Botticelli’s works, said: “Clearly this beautiful painting came from Botticelli’s studio. Probably Botticelli himself is responsible for more than a bit of it. A great deal more study is needed to solve the riddles of ‘how much’, ‘what parts’, ‘why’, ‘when’, and hopefully the painting can now be studied further by scholars and the public alike.”

• BBC Four’s Britain’s Lost Masterpieces can be viewed on the iPlayer.