During the
American Civil War, Whitman moved to
Washington, D.C., where he worked for the government and volunteered at hospitals. Although he never met Lincoln, Whitman felt a connection to him and was greatly moved by Lincoln's assassination. "My Captain" was first published in
on November 4, 1865, and appeared in
Sequel to Drum-Taps later that year. He later included it in the collection
Leaves of Grass and recited the poem at several
lectures on Lincoln's death.