Having entered West Point at the age of sixteen, he graduated in 1842 and was assigned to the Fourth Artillery Regiment as a second lieutenant. During the Mexican War he was wounded at the battle of Monterrey (18-21 Sept. 1846) and in the storming of Mexico City (13-14 Sept. 1847), in the process winning promotion to first lieutenant and being brevetted captain for gallantry in action. In 1849 he married Emily Plympton, the daughter of an army officer. In 1854, tiring of garrison duty along the frontier, he resigned from the army to take a position with the Cooper & Hewitt's Iron Works in Trenton, New Jersey. In 1858 he moved to New York City, where he was at first superintendent of street improvement, then deputy street commissioner under another future Confederate general, Gustavus W. Smith. His own entry into the Confederate service came exceptionally, and in the eyes of some southerners suspiciously, late, not occurring until September 1861, five months after the Civil War began. Even so, because of his high reputation in the "old army," he was appointed a major general on 7 October 1861 and placed in command of "Department No. 1"--New Orleans, the South's largest city and main port.
Albert Castel, "Lovell, Mansfield," American National Biography Online, February 2000, http://www.anb.org/articles/05/05-00453.html.