As a Union officer, William Shafter saw action at several fierce battles of the Civil War. He served as a first lieutenant in the 7th Michigan Infantry at Ball's Bluff, Virginia, before receiving a Medal of Honor for his conduct at Fair Oaks in 1862. Following the war, Shafter became commander of the 24th Infantry "Buffalo Soldier" regiment from 1869 until 1879.
With the outbreak of the Spanish-American War, Shafter was promoted to major general of volunteers and commanded the U.S. troops in Cuba. Upon his return to the United States, Shafter was named commander of the Department of California and the Columbia, a post he held until his retirement in 1901. Shafter died in 1906 and is buried in the San Francisco National Cemetery at the Presidio.
Shafter’s grave is in the Officers’ Section, Section 30, Grave 2.