He was appointed collector of the port of Boston by President James Madison in 1809, a position he held until January 27, 1812, when he was appointed senior major general in the United States Army in command of the northeast sector from the Niagara River to the New England coast. During the War of 1812, while Dearborn prepared plans for simultaneous assaults on Montreal, Kingston, Fort Niagara, and Detroit, the execution was imperfect. Some scholars believe that he did not move quickly enough to provide sufficient troops to defend Detroit. William Hull, without firing a shot, surrendered the city to British General Isaac Brock. Although Dearborn had minor successes at the capture of York (now Toronto) on April 27, 1813, and at the capture of Fort George on May 27, 1813, his command was, for the most part, ineffective. He was recalled from the frontier on July 6, 1813, and reassigned to an administrative command in New York City. Dearborn was honorably discharged from the army on June 15, 1815.