In The Adventures of Huckleberry Finn, by Mark Twain, the author's primary purpose in presenting the character of Huck Finn set in the South is to make a statement about conscience and freedom, and society.
...The Adventures of Huckleberry Finn takes place before the Civil War...
However, the book is written after the Civil War during the period known as the Reconstruction. Things did not improve much for blacks in the South—it was not interested in promoting the standing of blacks.
"Conscience" and "freedom" are not easily separable in this story, for Huck represents the young man who has the desire to be what the society tells him to be (if he wants to be a good Christian)—educated to accept the social mores of the time—as if this is the only thing that will redeem him.
[Miss Watson] was going to live so as to go to the good place. Well, I couldn't see no advantage in going where she was going, so I made up my mind I wouldn't try for it.
(They are referring to "hell," which Miss Watson threatens Huck with for poor behavior.) The sense of conscience is continually at war within Huck's heart as he tries to be society's definition of "good," but finds his love for Jim—his best friend—telling him something different, as Jim endeavors to gain his freedom. Huck has much more in common with Jim, it would seem, than he does with society.
Like Jim, Huck is a marginalized member of society: raised off and on by his drunkard father, Pap, Huck struggles with being "civilized," but thrives on the open water of the Mississippi where he, too, can be free—except when he gets caught up in the nonsense of this so-called "civilized" society. The King and the Duke pretend to be civilized, but are really members of a society they unscrupulously cheat. The Shepherdsons and the Grangerfords are not "civilized" as they believe, doing everything to wipe each other out in the midst of a long-standing "blood feud."
All of these things show the struggle within Huck to understand this thing called "civilized behavior," which to his young and unsophisticated mind, make no sense. And we know that Jim is a finer man than many whites: he is dedicated to the boys, refusing to leave an injured Tom:
I never see a n***er that was a better nuss or faithfuller, and yet he was risking his freedom to do it...
Huck's love for Jim drives his internal struggle (man vs self) so that he lets his conscience decide how he will handle Jim's quest for freedom versus southern society's condemnation of his actions to aid a black slave to freedom.
I'd see him standing my watch on top of his'n...so I could go on sleeping...[he]...said I was the best friend old Jim ever had in the world, and the only one he's got now...
Huck must choose between going to hell and saving Jim. He decides...
All right, then, I'll go to hell...
Of course, when Miss Watson frees Jim in her will, this vindicates Huck. If she decided to free Jim upon her death, none can find fault with Huck. Until her change of heart, Miss Watson didn't understand what she was doing to harm Jim:
That is just the way with some people. They get down on a thing when they don't know nothing about it.
And finally, the confinements of being a part of "genteel" society, Huck's puzzlement over the contradiction of its members' violent and cruel actions, and Huck's undeniable affection for Jim and wish for Jim's freedom—as well as Huck's own freedom—convince Huck that there is no place in genteel society for him.