He was commissioned first lieutenant for gallant service at the Battle of Pea Ridge, became captain during the Siege of Vicksburg and assistant Adjutant-General during the Atlanta campaign.
In 1882, he was the Republican Party's nominee for election to the Forty-eighth Congress in Iowa's 9th congressional district, but was defeated by Democrat William Henry Mills Pusey.
[2] Two years later, Anderson was not the Republican nominee, but he was credited with causing the nomination of "dark horse" candidate Joseph Lyman,[3] who then defeated Pusey in the general election.
In April 1886, Fremont County, where Anderson lived, was added to the Iowa's 8th congressional district, which Republican William Peters Hepburn had represented since 1881.
While remaining a Republican, he ran hard on a platform of stricter regulation of the railroads, and the use of tariffs for revenue only, that earned him the joint endorsement of the Democratic and Greenback parties.
[4] Hepburn's defeat caused many of his colleagues in the House to worry that they might meet the same fate if they did not respond to the popular anger by supporting stricter federal railroad regulation.