The Pope has uttered some common sense words about homosexuality – and about time, too. While stopping well short of a full recognition of gay rights, his declaration that he does not "judge" is at least the start of a better approach by the Catholic church.

In the Vatican museum he should contemplate Leonardo da Vinci's St Jerome in the Desert. An ascetic sits in anguished thought in a rocky wilderness in this unfinished masterpiece. It is a great, introspectively spiritual work of religious art whose creator was well known for his love of young men. Leonardo surrounded himself with good-looking assistants and painted a subversively gay icon of male beauty, his bronzed Saint John the Baptist. When da Vinci was in his 20s, he was formally accused of sodomy.

Brooding on these facts, the Pope might walk into the Pauline Chapel, to look upon Michelangelo's frescoes there. This chapel is in a private part of the Apostolic Palace not open to the public, but I don't think the Pope would find entry difficult. There, looking at the suffering of the saints, he might consider how Michelangelo courageously expressed his love for men, even as he created some of the most eloquent art of the church.

Is there no escape from this issue? Remembering that some art historians deny the so-called "calumny" that Caravaggio and his clerical patrons were gay, perhaps the Pope might visit the Roman church of San Luigi dei Francesi to look on this master's paintings of St Matthew. But the demons of desire cannot be suppressed. The naked male flesh in Caravaggio's paintings tells its own story. By the time Caravaggio came to Rome in the 1590s, Leonardo and Michaelangelo – not to mention the aptly named Italian painter Il Sodoma – had already blazed a gay trail through the art of the Holy City. Caravaggio made art dangerous and exciting again by taking that homosexual impulse to new extremes.

The history of art is inseparable from the history of sexuality. Artists were adventurous characters in the past just as they are today. To make great art you have to take great risks. The Catholic church in its golden age knew this, and it commissioned the boldest and best, whatever the artist's personal lives.

Perhaps the honesty of Pope Francis will renew art history, for pious timidity blunts understanding of great art. In particular, the myth that gay sex did not exist in the past, or was too risky, or could not be imagined, is nonsense. By the 18th century, gay clubs existed across Europe. The gay scene in Georgian London was intense. Is it really plausible that all this was going on in 1700 but unimaginable in Caravaggio's Rome in 1600?