Maine became a state on March 15, 1820, under the Missouri Compromise, which allowed Maine to enter the nation as a free state and Missouri as a slave state. Before that, Maine was a district of Massachusetts.
The citizens of Maine, especially inland farmers, campaigned to become a state for 35 years because they felt underrepresented in the Massachusetts legislature and felt that the state's tax laws were unfair. Finally in 1819, Massachusetts passed Maine's statehood bill, which then had to pass in United States Congress. At the same time, Missouri was also striving to become a state. Congress decided, in an attempt to keep the balance between the number of slave and free states, to allow Maine to join the Union as a free state and Missouri as a slave state. This was the Missouri Compromise and, despite objections from Maine's abolitionists who did not want any more slave states, the bill passed.