The rescued man, Leggat, confesses to being on the run, having killed a sailor on the Sephora, a ship anchored nearby.
The Captain hides him in his cabin, where Leggat becomes the Secret Sharer.
A friendship ensues, and as the days go by, the Captain needs to decide whether he will hand over Leggat to the Captain of the Sephora, who will have him executed, or he will help Leggat escape to a new life.
This is the plot of the short story The Secret Sharer by Joseph Conrad published in 1910. Every time I read it, I learn something more about the story and myself.