"O Captain! My Captain!" is an extended metaphor poem written in 1865 by Walt Whitman, about the death of American President Abraham Lincoln. The poem was first published in the pamphlet Sequel to Drum-Taps which assembled 18 poems regarding the American Civil War, including another Lincoln elegy, When Lilacs Last in the Dooryard Bloom'd. It was included in Whitman's comprehensive collection Leaves of Grass beginning with its fourth edition published in 1867.