On July 24 or July 25, 1846, Thoreau ran into the local tax collector , Sam Staples, who asked him to pay six years of delinquent poll taxes . Thoreau refused because of his opposition to the Mexican–American War and slavery , and he spent a night in jail because of this refusal. The next day Thoreau was freed when someone, likely to have been his aunt, paid the tax, against his wishes.  The experience had a strong impact on Thoreau. In January and February 1848, he delivered lectures on "The Rights and Duties of the Individual in relation to Government",  explaining his tax resistance at the Concord Lyceum . Bronson Alcott attended the lecture, writing in his journal on January 26:
After leaving Walden in 1847, Thoreau continued to find ways to support himself while writing. His principal paying employments after 1849 were pencil making and surveying. His parents’ house on Main Street in Concord remained Thoreau's home from 1850 until his death in 1862. He made several excursions, from a few days to a few weeks in duration, to Cape Cod, Maine, and Canada. These provided material for essays published in periodicals during his lifetime and gathered posthumously into three books, Cape Cod, The Maine Woods, and A Yankee in Canada. Most of Thoreau’s writing, except for two books, A Week on the Concord and Merrimack Rivers and Walden, and more than a dozen essays, including “Civil Disobedience” and “A Yankee in Canada,” was published after his death.
Thoreau also remained a devoted abolitionist until the end of his life. To support his cause, he wrote several works, including the 1854 essay "Slavery in Massachusetts." Thoreau also took a brave stand for Captain John Brown, a radical abolitionist who led an uprising against slavery in Virginia. He and his supporters raided a federal arsenal in Harpers Ferry to arm themselves in October 1859, but their plan was thwarted. An injured Brown was later convicted of treason and put to death for his crime. Thoreau rose to defend him with the speech "A Plea for Capt. John Brown," calling him "an angel of light" and "the bravest and humanest man in all the country."