Twain named his fictional character after a San Francisco fireman whom he met in June 1863. The real Tom Sawyer was a local hero, famous for rescuing 90 passengers after a shipwreck. The two remained friendly during Twain's three-year stay in San Francisco, often drinking and gambling together.[9]