<Tr> <Th> Melody </Th> <Td> "Protection" by Joseph Funk </Td> </Tr> <Tr> <Th> Published </Th> <Td> 1787 (1787) </Td> </Tr> <P> How Firm a Foundation is a Christian hymn, published in 1787 by John Rippon in A Selection of Hymns from the Best Authors, Intended to be an Appendix to Dr. Watts's Psalms and Hymns," known as "Rippon's Selection ." It is attributed only to "K," which probably refers to Robert Keen (e), precentor at Rippon's church, though other names suggested include Richard or John Keene, Kirkham, John Keith, or Words by G. Keith and Music by J. Reading as cited in the 1884 publication of Asa Hull's Jewels of Praise . It is most often sung to the tune "Foundation" (or "Protection") which first appeared in A Compilation of Genuine Church Music (1832) edited by Joseph Funk, though the original tune may be Keen (e)'s "Geard ." </P> <P> This was the favorite hymn of General Robert E. Lee and has been played at the funerals of several US politicians . On Christmas Eve 1898, American units involved in the Spanish--American War joined together to sing the hymn . The units were from the North and the South . </P>

Who wrote the hymn how firm a foundation