The beauty of Daniel Mason’s new novel, “The Winter Soldier,” persists even through scenes of unspeakable agony. That tension reflects the span of his talent. As a writer, Mason knows how to capture the grace of a moment; as a doctor, he knows how wrong things can go.

And just about everything goes wrong for Lucius, the young medical student at the center of this historical novel set during World War I. The scion of a wealthy family in Vienna, Lucius has disappointed his ambitious mother and his patriotic father by pursuing such a lowly career as medicine. When hostilities break out, they’re relieved that their son may finally have a chance to distinguish himself in the glories of battle. “The celebrations were hard to ignore,” Mason writes. “The entire city reeked of rotting flowers.” Lucius’s father arranges toy soldiers on an antique map and dresses up in a suit of armor. His parents can’t know — or don’t want to admit — just how much their world has changed.

Mason re-creates this era in all its dramatic flux and absurd optimism. Horses contend with trains; aristocrats sit for portraits even as Madame Curie takes pictures with X-rays. What awaits Lucius in the field is like nothing he could have imagined and certainly nothing that his interrupted medical training prepared him for. Most of his university classes involved little more than memorization. Mason notes that by the time he’s sent off, “Lucius had touched four living patients in addition to the old man he had liberated from earwax.” The army-issued medical manual offers advice on building latrines, soothing blisters with whale oil and providing “moral instruction for the soldier who misses the comforts of the wife.” Those will not be Lucius’s primary challenges.

As Mason showed in his previous novels, “The Piano Tuner” and “The Far Country,” he’s extraordinarily good at conjuring up journeys into unfamiliar places. The trek that Lucius endures deep into the forest to reach a field hospital feels like a tale the Brothers Grimm were afraid to include. When this 22-year-old medical student with a broken wrist finally arrives at a converted church, he asks the head nurse, “May I speak to the supervising physician” — and learns that he’s it.

The story that unfolds in this forsaken place is so captivating that you may feel as unable to leave it as Lucius does. That head nurse who opens the church door is, in fact, the only nurse. Sister Margarete has been managing the sick and dying by herself for months. A woman of iron practicality and boundless compassion, she has taught herself to remove crippling doubts and gangrenous limbs. Soldiers who harass her receive no morphine until they learn better manners. Her faith mingles ancient spirits with modern science. While she welcomes Lucius’s arrival, she does not hesitate to advise him and, if he resists, to correct him. She is Mason’s most irresistible creation — actresses all over Hollywood should be jockeying to play her part in the inevitable movie adaptation.

But despite Margarete’s tireless efforts, the conditions in this church are closer to a dungeon than a hospital. Patients — living and dead — arrive in jumbled clots of flesh by truck, by horse, even by wheelbarrow. Their wounds, carved by weapons ancient and modern, exceed anything the world has ever seen. Amputation is the common treatment, and lice the universal scourge. The descriptions of maggots are a vision of hell you will never forget.

Mason, who is a professor of psychiatry at Stanford University, is particularly interested in mental injuries, and “The Winter Soldier” offers a harrowing history of the treatment of “a new disease, born of the war,” what we now call PTSD. In the early pages of the novel, we see Lucius and a professor conducting neurological experiments on dogs, trying to discover a dye that might illuminate the pathways of the brain under an X-ray. They succeed only in killing a number of dogs, but “the dream of being able to see another person’s thinking” persists.

Months later, far from the laboratory in Vienna, Lucius finds himself confronted with apparently uninjured soldiers who present all manner of strange physical and emotional symptoms, “the tremors, the paralysis, the twitching, lurching gaits, the bizarre contortions of their arms.” For a doctor ordered to “patch and send” — to sew up men as quickly as possible and return them to the front — these mentally shattered patients pose a special dilemma. He suspects there must be “something beneath the skin, imperceptible, waiting to be found,” but he has no training, equipment or treatment to employ except his own sympathy.

And it’s Lucius’s sympathy that Mason deftly uses as the hinge of this heartbreaking plot. One of the disturbed soldiers who arrives at the church tempts the young doctor to imagine that he might be on the edge of making a breakthrough, of fundamentally helping a man who would otherwise be lost. (The treatments awaiting unresponsive soldiers in Vienna sound closer to torture, such as forcing a metal ball down the throat to encourage vocalization.) But a field hospital for a collapsing empire is no place for careful treatment, as Margarete knows — and Lucius must learn.

Lucius’s error is just a slight misapplication of empathy, an inconsequential footnote in the annals of WWI disasters, but in Mason’s careful telling, the trajectories of lives are determined by such decisions. “The Winter Soldier” draws us into the deadly undertow of history that swept away so many in the early 20th century. The redemption the story ultimately offers is equally unlikely and gorgeous, painfully limited but gratefully received in a world thrown into chaos.

Ron Charles writes about books for The Washington Post and hosts

The Winter Soldier

By Daniel Mason

Little, Brown. 336 pp. $28.