There are two versions of the Virgin of the Rocks, one (the earlier) currently in the Louvre, Paris and a second in the National Gallery, London. Scholars consider that the two canvases on this same subject are simply two versions of the same painting, with significant variants.
The Paris Virgin of the Rocks, entirely by Leonardo, is the one which first adorned the altar in the San Francesco Grande Church in Milan. It may have been given by Leonardo himself to King Louis XII of France, in gratitude. The later London painting replaced the one in the church of San Francesco at a later date, with Leonardo painting the central panel only.