“O For a Closer Walk with God” was written by William Cowper (1731-1800) in the year 1769 while Mary Unwin was gravely ill. She was like a mother to Cowper in many ways, though she was less than a decade older than him.

His own mother had passed when he was six years old. After her death, he was sent to a local boarding school. He studied law and took chambers at The Honourable Society of the Middle Temple in 1757. Just before that in 1756, his father passed away. He battled depression and other troubles after the loss of his mother and father. His father left him with little material wealth, so his family used their influence to obtain two administrative posts for Cowper in the House of Lords. This would require a formal examination, and the thought of it so troubled Cowper that he attempted to take his own life. As a result, he was confined to Cotton’s mental asylum for 18 months where he continued battling his troubles and worries.

A charitable and loving couple, Morley and Mary Unwin, met Cowper shortly after his release from the asylum. Morley was a clergyman with a charitable heart, and the two invited Cowper to stay with them for two weeks. Two weeks turned into twentytwo years! While there, he was able to learn many spiritual and practical treasures. He learned to garden, and grew closer to the Lord, which helped him battle his troubles.

In 1767, Morley Unwin died suddenly from a horse riding incident. Mary Unwin and her family moved to Olney, in Buckinghamshire, to sit under the preaching of John Newton. Cowper went with them, and would meet Newton in the lawn between their houses often. Newton (who wrote “Amazing Grace”) had battled many troubles from his past, and the two quickly became closely bonded. Cowper would accompany and aid Newton in his ministerial duties such as visiting the sick. They collaborated on the "Olney Hymns Hymnal.” Cowper provided 67 of the 349 hymns in the collection. Newton provided the others.

In 1769, Mary Unwin fell greatly ill, which brought back many of the anxiety and troubles that Cowper had battled his whole life. After all, she had been somewhat of a mother figure for him since they had taken him in years ago. He prayed fervently for her while also examining himself. During this time of prayer, he penned the words to “O For a Closer Walk with God.”

He described the event, saying, “She is the chief of blessings I have met within my journey since the Lord was pleased to call me... Her illness has been a sharp trial for me. Oh, that it may have been a sanctified effect, that I may rejoice to surrender up to the Lord my dearest comforts, the moment He may require them... I began to compose the verses yesterday morning before daybreak but fell asleep at the end of the first two lines: When I awakened, the third and fourth were whispered to my heart in a way which I have often experienced."

Cowper’s prayers were heard, and she recovered. She lived many years after, eventually passing in December of 1796. His fervency in prayer, and his deep soul searching, are a reminder to us all to seek a closer walk with our Shepherd each day. Lord, help us to tear every idol down from Thy throne and worship only Thee! Grant us the soul refreshing view of Thy countenance toward us and Thy Holy Word!