Virgil is the shade of the poet from Mantua, author of the Aeneid, who guides Dante through Inferno and continues to guide him through Purgatory up to the top of the stairs of the Earthly Paradise. In the common reading, he stands for human reason: he leads as far as intelligence reaches and says where that reach ends.
He is a pagan from Limbo and, for that reason, accompanies a climb in which he does not take part. He says himself, to Sordello, that he lost the power to see the high Sun "not by doing, but by not doing", and that he came to know it late. In Purgatory he no longer knows the way: he asks the souls, reasons aloud and prays to the sun, choosing the light he has in sight.
But his word is the most trustworthy on the mountain. At the center of the poem he gives the lesson on love, in which he shows that every act is born of love and that only the object and the intensity vary. When Dante objects that, if love comes from outside, there is no merit, he answers as far as reason sees and hands the rest to Beatrice: "a work of faith". Statius owes him his poetry and his faith, and compares him to someone who carries a light behind himself and gains nothing from it.
In no canto does the poem belittle him. He goes the wrong way, grows impatient and becomes troubled, but the image he leaves is that of a master who knows the measure of what he knows. His office ends in canto XXX, when Dante turns and the place is empty.