King David is an example of being consistent in prayer no matter what life throws at you or what good or bad you do, Pope Francis said during his general audience Wednesday.

Prayer "is able to ensure the relationship with God, who is the true Companion of man's journey, in the midst of the many hardships of life: good or bad," the pope said June 24.

"But always prayer: 'Thank you, Lord. I'm afraid, Lord. Help me, Lord. Forgive me, Lord.'"

Speaking via livestream from the apostolic library, Francis continued his general audience talks on prayer with a reflection on the life of King David.

This was the pope's final general audience before the summer break in July.

David, he said, was "saint and sinner, persecuted and persecutor, victim and executioner, which is a contradiction. David was all this, together. And we too have often opposite traits in our lives; in the plot of living, all men often sin inconsistently."

But, the pope emphasized, the consistent "thread" in David's life was prayer.

"David the holy, prays; David the sinner prays; David the persecuted prays; David the persecutor prays; David the victim prays. Even David the executioner prays," he stated.

In the psalms, "David teaches us to bring everything into dialogue with God: joy as guilt, love as suffering, friendship as much as an illness. Everything can become a word addressed to the 'You' who always listens to us."

Pope Francis went on to explain that though David knew solitude and loneliness in his life, through the power of prayer he was never alone.

"David's confidence is so great that when he was persecuted and had to flee he did not let anyone defend him," the pope noted. David thought, "'If my God humiliates me like this, He knows,' because the nobility of prayer leaves us in the hands of God. Those hands, wounds of love: the only safe hands we have."

In his catechesis, Francis looked at two characteristics of David's life and vocation: that he was a shepherd and that he was a poet.

David "is a sensitive person who loves music and singing," the pope noted. "The harp will always accompany him: sometimes to raise a hymn of joy to God (cf. 2 Samuel 6:16), other times to express a lament, or to confess his sin (cf. Psalm 51:3)."

"His gaze catches, behind the unraveling of things, a greater mystery," he said, adding that "prayer arises from there: from the belief that life is not something that slides into us, but an amazing mystery, which evokes in us poetry, music, gratitude, praise, or lamentation, supplication."

Francis explained that though David often did not live up to his task as a "good shepherd" and king, in the context of salvation history David is the "prophecy of another King, of whom he is only an announcement and prefiguration."

"Beloved by God since he was a boy, he is chosen for a unique mission, which will play a central role in the history of the people of God and our own faith," he said.

(Story continues below)

In his greeting to Spanish speakers after his catechesis, Pope Francis noted the 7.4 magnitude earthquake which struck the state of Oaxaca in southern Mexico Tuesday, resulting in injuries and at least two deaths, as well as extensive damage.

"We pray for all of them. May the help of God and brothers give you strength and support. Brothers and sisters, I am very close to you," he said.