The beautiful 15th-century frescoes hidden behind a false roof in the cathedral of Valencia, eastern Spain, were a spectacular find – a remarkably well-conserved example of work by the Renaissance master Paolo da San Leocadio featuring winged angels crowned with golden haloes.

Restoration came with a set of unique problems. A 17th-century workman, for example, had added his own graffiti touches to the frescoes before covering them over, including one that is familiar to school toilets across the western world: a depiction of a full set of male genitalia scratched into an angel's wing.

"The truth is that we have barely advanced over the centuries," Carmen Pérez, head of Valencia's conservation institute, told El Mundo newspaper. "They are exactly the same as you would find today in public toilets."

The graffiti was only part of the damage inflicted on the frescoes by those who covered them up in 1674 – when damp was already deemed to be making them grubby and worthless.

Workmen also tested their plaster-flicking accuracy on the Renaissance masterpiece, aiming at angels' eyes, mouths and other targets as they threw blobs of sticky plaster around.

The frescoes were rediscovered eight years ago, with cathedral records showing they had been commissioned by Rodrigo Borgia – a Valencian-born bishop and cardinal who became Pope Alexander VI and sired a generation of scandalous Borgias, including Lucrezia and Cesare.

They were found when Pérez and her team started restoring the 17th-century baroque vault built underneath them.

A hole in the vault gave way to an 80cm (2ft 6in) deep air chamber where pigeons had been nesting. Above the pigeons were the smoke-blackened remains of the once-colourful Renaissance frescoes featuring a dozen angels playing harps, pipes and other medieval instruments.

These have now been restored, and the graffiti removed, as art historians rewrite the history of Renaissance art in Spain.