Throughout Huckleberry Finn, Huck struggles to reconcile his upbringing, which has taught him all his life that it is a sin to help a slave escape, and his love for Jim. He feels a deep obligation to Jim, who has acted as the kind father to him he has never had. This conflicts with his feelings of obligation to return Miss Watson's "property"—Jim—to her.
In chapter 8, Huck ponders his helping Jim to freedom and what people would think of him at home for helping a slave escape. However, he knows how much Jim longs for freedom and decides he doesn't care what people might think:
People would call me a low-down Abolitionist and despise me for keeping mum—but that don't make no difference.
At this point, Huck is on the side of freedom.
Later, in chapter 16, Huck and Jim worry that they have floated past Cairo without seeing it. This town is especially important to Jim because if he gets there. he will be out of slave territory and will be free. He keeps an eye out for it because, according to Huck:
he'd be a free man the minute he seen it, but if he missed it he'd be in a slave country again and no more show for freedom.
Yet, while Huck continues to understand Jim's deep yearning to be free, he still wrestles with his moral dilemma about stealing Miss Watson's "property" by helping Jim to freedom. Huck asks himself,
What did that poor old woman do to you, that you could treat her so mean?
Finally, Huck writes Miss Watson a letter in which he tells her he has Jim and where to find him. At first, he feels good about helping Miss Watson. But as Huck thinks more about it in chapter 31, he changes his mind, remembering all Jim's kindnesses to him:
I'd see him standing my watch on top of his'n, 'stead of calling me, so I could go on sleeping; and see him how glad he was when I come back out of the fog; and when I come to him again in the swamp, up there where the feud was; and such-like times; and would always call me honey, and pet me and do everything he could think of for me, and how good he always was; and at last I struck the time I saved him by telling the men we had small-pox aboard, and he was so grateful, and said I was the best friend old Jim ever had in the world, and the only one he's got now; and then I happened to look around and see that paper.
Huck knows he is facing a moral dilemma between keeping Jim enslaved or helping to freedom and has to figure out for himself what to do as he holds the letter he has written to Miss Watson:
I took it up, and held it in my hand. I was a trembling, because I'd got to decide, forever, betwixt two things, and I knowed it.
Finally, he makes the right choice: he says,
"All right, then, I'll go to hell"—and tore it up.