Marston was promoted to brigadier general of U.S. volunteers, effective November 29, 1862. Prior to the Chancellorsville campaign, he was relieved from duty with the Army of the Potomac and assigned to the defenses of Washington where he returned to his seat in Congress. After Gettysburg, Marston was directed to establish a prison camp in Maryland, which later became known as Point Lookout. The area was designated the District of Saint Mary's under the overall command of Maj. Gen. Benjamin Butler. In 1864, he commanded a brigade in Maj. Gen. W.F. "Baldy" Smith's XVIII Corps during the Bermuda Hundred Campaign. He took part in a disastrous assault on Cold Harbor, where his brigade suffered heavy casualties. During the Union assaults on Petersburg, Gilman assumed command of the 1st Division in the XVIII Corps on the last day of battle. Thereafter he commanded the Union troops on the north side of the James River with his headquarters located at Fort Pocahontas. Occasionally he returned to command of the 1st Division, including a brief stint during the Second Battle of Fair Oaks. Having been re-elected to Congress he resigned 1865, whereupon he received the thanks of the state of New Hampshire.
U.S. Congress
Marston was elected to the Thirty-ninth Congress (March 4, 1865–March 3, 1867) and in 1870 declined the Governorship of Idaho Territory. In 1872, 1873, and 1876 to 1878, he was again a member of the State house of representatives. He was an unsuccessful candidate for election in 1876 to the Forty-fifth Congress and was a delegate to the State constitutional convention of 1876.
On March 4, 1889, Marston was appointed to the U.S. Senate to fill the vacancy in the term commencing on that date and served until June 18, 1889, when a successor was elected. He died in Exeter in 1890; interment was in Exeter Cemetery.