He is depicted as a righteous king, although not without faults, as well as an acclaimed warrior, musician, and poet, traditionally credited for composing many of the psalms contained in the Book of Psalms .