Scobie is a police officer in a colony in British West Africa during World War II. He is married to Louise, an intellectual woman. They had one daughter, Catherine, who died many years ago. Both of the Scobies are Catholic. Scobie does not actually love his wife, but he pities her and feels a great deal of responsibility for her happiness. He enjoys his job, but Louise is frustrated when he is passed over for the Commissioner's position because of unproven rumors about infidelity and corruption. Louise is miserable with colony life and begs Scobie to send her to South Africa - he can come join her after he retires. Scobie promises to find a way to get the money to secure her passage.
A young man named Wilson is new to the colony; Greene later reveals him to be a spy and an inspector. Wilson strikes up a friendship with Louise over their shared love of poetry. After meeting her only a few times, Wilson falls in love with Louise, but she does not return his sentiments. Meanwhile, Scobie tries to borrow money from the bank but his loan application is rejected. Finally, Scobie turns to a disreputable Syrian trader named Yusef. Louise is able to leave the colony and Scobie feels an immense sense of peace and happiness, although he has become rather ambivalent about his faith.
One day, there is a shipwreck at sea and the survivors arrive in the West African colony. Scobie befriends one of the survivors, a young woman named Helen Rolt. That friendship soon blossoms into a romance. As a result, Scobie starts to feel a deep sense of responsibility for Helen as well. Scobie constructs a complicated web of lies in order to keep the relationship secret. In addition, he invents even more falsehoods to avoid being implicated in Yusef's scandalous business of selling contraband diamonds.
Scobie and Helen's relationship becomes predictably quotidian; she claims that he does not love her and is using his Catholicism to avoid divorcing his wife. They fight bitterly, but Scobie remains committed to Helen. He continually feels the weight of his religion, however, and vacillates between breaking up with Helen and following God's path.
Scobie receives a telegram from Louise saying that she has made a mistake and is coming back. This infuriates Helen and they have another explosive fight, but she later apologizes and says she will do anything for him. Scobie, for his part, feels oppressed and trapped; he begins to think that people are spying on him. He faces official questioning about his role in the Tallit/Yusef affair and starts to question Wilson's identity. Scobie even begins to suspect his young servant boy, Ali, whom he has long loved and trusted.
Louise returns to the colony and insists that she and Scobie renew their faith and begin attending Mass and Communion. He resignedly agrees but avoids going to church for a while due to his guilt over his indiscretions. He finally goes to Confession and tells the local priest, Father Rank, about his adultery. However, it is a troubling encounter because Scobie cannot bring himself to repent fully for his affair with Helen. Father Rank says he will pray for Scobie.
Scobie's paranoia matches his concerns about his soul. He tells Yusef that he is worried about Ali's loyalty and wonders what he might know. Yusef takes care of the problem by killing Ali. Even though Scobie was unaware of Yusuf's intent, he feels partially responsible for the Ali's fate and broods over his propensity for causing pain to others.
Scobie continues to go to church but still feels like an outsider. However, his professional life improves when he is awarded the Commissioner position after all. He has a chance encounter with Helen, who has largely left him alone since Louise returned. Helen tells Scobie that she is leaving the colony and wants to make it easy on him, but he cannot extricate himself the relationship and tells her he will figure out a plan.
Scobie formulates a plan to commit suicide. Because he has long complained of ill health, a local doctor prescribes Scobie some medication for his heart. He takes some each night but saves a dose for one night fixed in the near future. He wants his death to look natural; he does not want anyone to know that he has committed suicide. He wrestles with his idea of God, but ultimately believes that he must kill himself because he cannot keep living a life of adultery on without repenting. He takes the medication with a glass of whiskey and dies.
After Scobie's death, Louise and Wilson talk. Louise knew all along Scobie was having an affair, which is why she came home. Clearly, Scobie was very bad keeping secrets. Similarly, Wilson's keen eyes allow him to suspect that Scobie retroactively added diary entries about sleeping troubles and heart pain in his efforts to conceal the reality of his death. Louise is shocked. She visits Father Rank and excoriates Scobie for being a bad Catholic. However, Father Rank gently reminds Louise that they cannot judge Scobie's heart and that the rules of the Church are not what determine one's eternal fate. To Rank, it seems like Scobie loved God more than anyone else, even himself.