When Missouri, which allowed slavery, applied for statehood in 1819, Congress struggled for a way to maintain the Union despite strongly opposing pro-slavery and antislavery constituencies. After heated debate, Congress adopted the Missouri Compromise, which admitted Maine as a free state to balance Missouri and prohibited slavery north of the 36º 30´ latitude in the Louisiana Territory.
And be it further enacted, That in all that Territory…which lies north of thirty six degrees and thirty minutes north latitude…Slavery and involuntary Servitude otherwise than in punishment of Crimes whereof the party shall have been duly convicted, shall be and is hereby forever prohibited.
Records of the Joint Committees of Congress, National Archives and Records Administration