An unnamed captain, reflecting on an experience that happened years ago, tells his readers of his first real command - when he was appointed to take a ship home to England, when the crisis of imitation into knowledge of his ship and his crew was complicated by an unforeseen partnership with an escaped criminal. The episode begins in the Gulf of Siam, just off the coast of Cambodia.
As a sailing ship awaits a favorable wind, darkness falls, and the captain surprises the crew by taking the anchor watch himself. As he strolls the silent deck in his sleeping-suit, his serene reverie is broken by his discovery that the rope side-ladder has not been hauled in. The captain is astonished to find that a naked swimmer is floating at the end of the ladder. In the quiet of the sleeping ship, the two talk and the man, named Leggatt, elects to come on board. The captain, sensing "a mysterious communication" has been established between them, provides his intuitively perceived "double" with an identical sleeping-suit.
As the dialogue continues, the captain is startled to learn that Leggatt, a young chief mate, has killed a man at sea and has been held prisoner for weeks aboard the Sephora. As Leggatt relates the particulars of the homicide, the captain finds that the fugitive appeals to him "as if our experiences has been identical as our clothes." Leggatt tells how a seaman panicked during the fury of a storm as they were trying to set a reefed foresail, how he fought the man - and later, when the storm subsided, the seaman was dead and Leggatt was charged with his murder. As the captain listens to the account, his identification with Leggatt deepens "I saw it all going on as though I were myself inside that other sleeping-suit." He takes Leggatt to his stateroom, and the grimly comic game of hosting his "secret sharer" begins.
Part 2 of the tale opens with a visit from Captain Archbold, skipper of the Sephora, who is searching for his fugitive first officer. The narrator later will state that "I could not, I think have met him by a direct lie" - and for psychological (not moral) reasons." But the narrator goes beyond deceptive actions to protect his partner with saving lies. Although Captain Archbold admits that Leggatt's reefed sail saved his ship in the storm, this self-righteous guardian of law and order is determined to give his mate up to the shore authorities. Leggatt's protector goes through the successful charade of showing his suspicious visitor over the ship, and at last Archbold leaves empty-handed.
The ship makes its way down the east side of the Gulf of Siam and at last, among some islands off Cambodia, the captain agrees to help Leggatt swim to freedom. To the surprise of the crew, the captain tacks the ship and sails in dangerously close to the shore. He smuggles Leggatt into the sail locker, and just before they shake hands and part, he places his hat on his "other self."
By now the crewmen are watching in awed silence as the ship moves toward the towering blackness of Koh-ring. The captain, a stranger to his ship, finds it impossible to tell whether she is moving safely away from disaster until in the gathering darkness he detects, floating near the ship's side, the hat he had given to Leggatt. This "saving mark" confirms that the ship is sailing out of danger. With the secret stranger gone, the captain is left alone with his ship at last, enjoying "the perfect communion of a seaman with his first command." He walks to the taffrail and catches a final evanescent glimpse' of the white floppy hat, left behind to mark the spot where the captain's "secret sharer," his "second self," had "lowered himself into the water to take his punishment; a free man, a proud swimmer striking out for a new destiny."