Why was Henry David Thoreau sentenced to jail?

In 1846, the 29-year-old Henry David Thoreau was charged with nonpayment of a poll tax.

Thoreau refused to pay because the tax was to be spent on the Mexican War, which he opposed.

Thoreau’s friends paid the tax for him, after he spent the night of July 23, 1846, in jail.

He described the experience in his 1849 essay, “Civil Disobedience.”