Sheltering in place during the coronavirus pandemic can take a toll on even the hardiest of souls. But imagine the effects of quarantine on a society, and a man, who have an even murkier understanding of its effects. The pandemic led me to revisit Stewart O’Nan’s haunting and oddly prescient 1999 novel “A Prayer for the Dying,” a little masterpiece of realistic horror and the deterioration of a decent man overwhelmed by circumstances.

The man in question is Jacob Hansen, a Civil War veteran (still haunted by the horrors of that conflict) who has settled with his wife and infant daughter in the prairie town of Friendship, Wisconsin. There, he serves as sheriff and preacher and undertaker — overlapping jobs that will quickly exhaust him when a diphtheria epidemic creeps into the community during a dry-as-drought late summer.

Before long, both his (not yet speaking) daughter and his wife are sick. He begins quarantining houses and shutting down the entire town, posting keep-out notices on the roadways enforced by deputies from the neighboring town. (In a truly surreal moment, he must even turn away a traveling circus, complete with an elephant.)

But the locals bristle at the news, and the warnings of those in authority, in a way that should seem familiar to anyone watching the news in 2020. “All morning the quarantine brings town out of their houses. To challenge it, to complain of the decision, dispute its usefulness, its legality,” O’Nan writes, noting the objections to barring family and goods from entering. “Why can’t they come in if they want to? It’s their risk, no one else’s. Long as no one’s going out, what’s the difference?”

And as a deadly wildfire approaches the town giving another reason to flee, Jacob realizes that he may have to go to extraordinary lengths to enforce his quarantine — and to keep his community safe.

O’Nan writes in a muscular second-person singular, present tense, taking us inside the mind of a good man as he slowly unravels from the pressure of an impossible job. Here is a man of deep faith who chastises himself for any doubt about his beliefs, likens himself to Job, and who goes to extraordinary lengths to keep himself in denial — even dressing his wife and daughter each day long after the sickness has claimed them.

Here also is a 19th-century man whose grasp of the science of epidemic is strong enough to impose a quarantine on his beloved town but who realizes only too late what a modern reader must grasp right away: that he is the vector bringing death to his flock even in his well-meaning efforts to protect and comfort them. This is not the stuff of horror, then, but of tragedy.