In thankfulness for a providential escape of the King from shipwreck, the Rev John Gostling, who had been of the royal party, put together some verses from the Psalms in the form of an anthem, and requested Purcell to set them to music. The work is a very difficult one, including a passage which traverses the full extent of Gostling's voice, beginning on the upper D and descending two octaves to the lower.