When he was four, Twain's family moved to Hannibal, Missouri,[15] a port town on the Mississippi River that inspired the fictional town of St. Petersburg in The Adventures of Tom Sawyer and the Adventures of Huckleberry Finn.[16] Slavery was legal in Missouri at the time, and it became a theme in these writings.