On the surface, the poem takes place on a ship that has reached the end of a long and dangerous ocean voyage, and which is now sailing into its home port. However, the scenario set forth in the poem also serves as an extended metaphor for the United States of America. The ship symbolizes the state, which the “captain”—that is, President Abraham Lincoln—has successfully navigated through the rough seas of the Civil War. The poem is thus better described as taking place in America, just as the Union secured victory and prevented the secession of the Confederacy. The end of the Civil War brought with it a contradictory atmosphere of celebration and devastation. Though glad for the restoration of peace, the nation remained torn apart by four years of violence. To add further to the turbulence of the time, President Lincoln was assassinated just five days after the South’s surrender. Whitman reflects the contradictory emotions that attended the Civil War’s end by depicting the speaker mourning his dead captain amid the jubilant sounds of celebration, as in lines 3–8:

     The port is near, the bells I hear, the people all exulting,
     While follow eyes the steady keel, the vessel grim and daring;
                              But O heart! heart! heart!
                                 O the bleeding drops of red,
                                    Where on the deck my Captain lies,
                                       Fallen cold and dead.

Despite “the people all exulting,” the speaker still feels overcome with sadness.