Jojo Moyes builds on her strengths in this moving and accomplished new novel. As she did in the best-selling “Me Before You,” she asks readers to think in fresh ways about a morally complex issue. Shifting between different eras with the same deftness that distinguished “The Last Letter From Your Lover,” Moyes creates two emotionally compelling story lines in “The Girl You Left Behind.”

The first concerns Sophie Lefèvre, struggling to keep her family’s hotel afloat under the German occupation of France in 1916. We see how tough Sophie is when she faces down the local Kommandant, who’s been informed that her family is harboring illegal livestock. Reminding him that the French are starving while the German army feasts on their confiscated food, she invites him to search the hotel — while holding a contraband piglet swaddled in her arms like an infant.

“How did you become so brave?” asks her sister Hélène after the Kommandant retreats. Warm memories of her husband, Edouard, an artist now serving at the front, provide the answer. Meeting a Parisian shopgirl who had fled from a brutal father in the provinces, Edouard saw a proud, self-reliant woman he longed to paint. His loving portrait of “the glowing girl willful in her confidence” now hangs in the hotel bar, though Hélène warns that it’s risky to keep it where the Germans can see it.

Indeed, it is. The Kommandant notices the painting, and his comments reveal a cultured man who knows art. A wary connection grows between him and Sophie, and Moyes challenges our natural sympathies by depicting the townspeople of St. Péronne as narrow-minded and censorious, quick to condemn a local woman as a collaborator. Sophie hears cries of the slur “Putain!” after she makes the dangerous decision to ask for the Kommandant’s help when she learns that Edouard has been sent to a prison camp. All seems lost when she is arrested and loaded into a cattle truck while her neighbors jeer.

Ninety years later, Sophie’s portrait hangs in the London house of Liv Halston, a grieving young widow who cherishes it as a memento of her husband, David. He bought it for Liv in Barcelona, seeing in his new wife’s eyes the same glow of fulfilled love that Edouard captured in “The Girl You Left Behind” (as the painting is now titled). Unfortunately for Liv, David was a rising modernist architect who allowed a magazine to photograph their house. Four years after his death, a Lefèvre descendant spots the “lost” painting in one of those photos and demands its return as “the subject of a forced or coercive sale.”

Even more unfortunately for Liv, that terrific guy she recently met, the one who makes her feel “she is more than the girl David left behind,” turns out to be working for the Lefèvres. Paul McCafferty, co-director of a company specializing in the return of artworks looted during wartime, doesn’t make the connection with the painting he’s been asked to trace until he notices it in Liv’s bedroom. He’s mortified, and she feels betrayed.

Moyes again rejects black-and-white judgments as Liv refuses to surrender the portrait and becomes subject to unthinking public hostility. Never mind that the painting disappeared during World War I, not World War II; headlines blare: “Million-Pound Battle for Nazi-Looted Art.” She gets hate mail urging her to “end the suffering of the Jewish people. Return what is rightfully theirs.” But Lefèvre is neither Jewish nor particularly nice, and his motive is crass: “Why should someone else benefit financially from a work that should be in our possession?”

“It’s about money,” Liv bitterly tells Paul, but all the facts seem to be against her as the case goes to court. Documents produced at the trial immerse us again in Sophie’s ordeal during the war, which is cross-cut with Liv’s modern-day struggle. Moyes skillfully ratchets up the tension as every new courtroom revelation reinforces the impression that Sophie’s portrait was stolen by the vengeful Kommandant.

A little plot manipulation late in the story is more than compensated for by Moyes’s finely wrought portraits and nuanced depictions of some very gray areas. “The Girl You Left Behind” is strong, provocative, satisfying fiction.

Smith is the author of “Real Life Drama: The Group Theatre and America, 1931-1940.”