The composer wrote the words (the libretto) himself. It was based on a play by Aleksandr Pushkin. Mussorgsky also read a famous book on the history of Russia: Nikolay Karamzin's "History of the Russian State" and used some of the historical material from this book.