At the outbreak of the Civil War, he raised a company of cavalry and was given the rank of captain at the head of that unit. After learning that his company would not be sent to the front lines, he resigned his command and returned east, where he was appointed aide-de-camp to General George B. McClellan. McMahon remained with the Army of the Potomac throughout the war, eventually rising to the rank of lieutenant colonel.[3] He served as aide de camp to William B. Franklin (May 1862- January 1863) and Chief of Staff and Assistant Adjutant General of the 6th Corps (1 January 1863 to August 1865), serving under John Sedgwick and Horatio G. Wright. McMahon was with 6th Corps commander John Sedgwick at Spotsylvania when Sedgwick was killed. McMahon was the author of Maj. Gen. John Sedgwick - In Memoriam (1885).
Decades after the end of the conflict, on March 10, 1891, he was awarded the Medal of Honor for his actions at the Battle of White Oak Swamp on June 30, 1862. His official citation reads: "Under fire of the enemy, successfully destroyed a valuable train that had been abandoned and prevented it from falling into the hands of the enemy."[4]
McMahon's two older brothers were also officers in the war, both with the 164th New York Volunteer Infantry. John Eugene McMahon (1834–1863) commanded the 164th before being injured; he later died of these injuries. Middle brother James Power McMahon (1836–1864) took over the regiment and led it until his death at the Battle of Cold Harbor.[2]
McMahon was mustered out of the volunteers on February 21, 1866.[3] On January 13, 1866, PresidentAndrew Johnson nominated McMahon for appointment to the grade of brevetbrigadier general of volunteers, to rank from March 13, 1865, and the United States Senate confirmed the appointment on March 12, 1866.[5] On March 16, 1866, President Johnson nominated McMahon for appointment to the grade of brevet major general of volunteers, also to rank from March 13, 1865, and the United States Senate confirmed the appointment on April 10, 1866.[6] After the war, he was elected as a companion of the New York Commandery of the Military Order of the Loyal Legion of the United States.
He received a Doctor of Laws degree from St. John's College, Fordham.[1] He was New York City's corporation counsel for two years before becoming the United States minister to Paraguay, a position he held from 1868 to 1869.[2] After returning to the U.S., he served as the Receiver of Taxes in New York from 1873 to 1885 and then worked as a U.S. Marshal for four years. During this time he became connected with the National Soldiers' Home, of which he would serve as president for several years.[1]
He served as Minister Ambassador to Paraguay during the Paraguayan War, also known as War of the Triple Alliance. He was a fierce champion of Francisco Solano López and wrote many articles very favourable to the Paraguayans.[7]