The Mariner is cursed, evidently by God, for killing the albatross for pure sport or amusement. When he finally manages to return to his home port aboard a ship manned by a ghostly crew, he meets a holy man he calls the Hermit who gives him forgiveness for his sin of killing the bird.
He'll shrieve my soul, he'll wash away
The Albatross's blood.
But this forgiveness is given on condition that the Mariner must perform an act of penance. He is required to tell his story over and over during his wanderings, and he is devoting his life to finding appropriate listeners, of whom the Wedding-Guest is one. The Mariner knows intuitively which man he should force to listen to his tale.
Since then, at an uncertain hour,
That agony returns;
And till my ghastly tale is told,
This heart within me burns.
The Ancient Mariner concludes his tale by explaining its moral. The moral, summarizing what he has learned from from the terrible ordeal of his long voyage, is that we should learn to love all living creatures. It is best remembered as it is expressed in one of the concluding stanzas.
He prayeth best, who loveth best
All things both great and small;
For the dear God who loveth us
He made and loveth all.
The Mariner is no longer exactly cursed for killing the albatross. He has been "shrieved" by the holy Hermit, and he will remain forgiven as long as he continues to perform his penance by telling his story.