Abraham Lincoln was the 16th President of the United States, serving from March 1861 until his assassination in April 1865. He successfully led his country through its greatest constitutional, military and moral crisis – the American Civil War – preserving the Union while ending slavery, and promoting economic and financial modernization. Reared in a poor family on the western frontier, Lincoln was mostly self-educated. He became a country lawyer, a Whig Party, Illinois state legislator in the 1830s, a one-term member of the United States House of Representatives in the 1840s, but he failed in two attempts to be elected to the United States Senate in the 1850s. After opposing the expansion of slavery in the United States in his campaign debates and speeches, Lincoln secured the Republican Party nomination and was elected president in 1860. Before Lincoln could take office in March of 1861, seven southern slave states declared their secession and formed the Confederacy. When war began with the Confederate attack on Fort Sumter on April 12, Lincoln concentrated on both the military and political dimensions of the war effort, seeking to reunify the nation. He vigorously exercised unprecedented war powers, including the arrest and detention without trial of thousands of suspected secessionists. He prevented British recognition of the Confederacy by skillfully handling the Trent affair late in 1861. His efforts toward the abolition of slavery include issuing his Emancipation Proclamation in 1863 and encouraging Congress to propose what would become the Thirteenth Amendment to the United States Constitution. Lincoln closely supervised the war effort, especially the selection of top generals, including commanding general Ulysses S. Grant. He brought leaders of various factions of his party into his cabinet and pressured them to cooperate. Under his leadership, the Union set up a naval blockade that shut down the South's normal trade, took control of the border slave states at the start of the war, gained control of communications with gunboats on the southern river systems, and tried repeatedly to capture the Confederate capital at Richmond. Each time a general failed, Lincoln substituted another until finally Grant succeeded in 1865.