Hamilton chose to follow the Union cause and was appointed colonel of the 3rd Wisconsin Infantry on May 11, 1861, and was promoted to brigadier general on May 17. He was then given brigade command in Maj. Gen. Nathaniel P. Banks' division of the Army of the Potomac. At the outset of the Peninsula Campaign, Hamilton was given command of the 3rd Division, III Corps. He led this division during the Siege of Yorktown, but drew the ire of George B. McClellan for insubordination. Ignoring the fact that shelving Hamilton would create powerful political enemies, McClellan relieved Hamilton on April 30, 1862 without explanation. When Lincoln pointed out the impropriety of McClellan's action, McClellan claimed "You cannot do anything better calculated to injure my army ... than to restore Gen. Hamilton to his division." Before the month-long siege preparations were complete, Hamilton was transferred to the Western Theater where he commanded the 3rd Division in the Army of the Mississippi at the battles of Iuka and Corinth. Following Corinth in October 1862, he was promoted to major general, effective from September 19, 1862.