Gabby and David Tracy had become rather fond of the large painting of Ivan the Terrible that had been left behind in a house David Tracy bought when he first came to Ridgefield, Conn., in 1987.

When the couple married four years later and moved to another house in the same town, they spent $37,000 to build an addition designed to display the artwork of the Russian czar fleeing the Kremlin. It measured 64 square feet.

The Tracys enjoyed the painting for years before they retired — she from teaching high school, he from finance — and in 2017 decided to sell their art collection and move to a small condominium in Maine.

The couple — both in their early 80s — hoped money from Mikhail N. Panin’s “Secret Departure of Ivan the Terrible Before the Oprichina,” or repression, would pad their retirement nest egg. It had been appraised at about $5,000.

But a researcher at the Potomack Co., an auction house in Alexandria, Va., discovered that the painting had been stolen from a museum in Nazi-occupied Ukraine in 1941, during World War II.

The museum confirmed as much in an urgent email to the firm on Nov. 17, 2017, the day before the auction had been scheduled. “Please stop selling this painting at auction,” the email said in part.

The auction house called the FBI. Now the federal government — and the Tracys — are hopeful the artwork will soon be headed back to the country from which it was stolen.

Gabby Tracy said it was what she learned about the painting’s history in the hands of the Nazis that gave “such a big shock to me.”

Gabby Tracy is a Holocaust survivor.

She was born in Slovakia and taken to a Jewish ghetto in Budapest when she was about 9 years old. Her father, Samuel Weiss, perished in a concentration camp; she was liberated at war’s end.

Now, she had learned that a painting she had on her wall had been looted from the Dnepropetrovsk Art Museum in Ukraine. Federal prosecutors blame German forces, but somehow the painting got into the hands of a Swiss border guard.

The U.S. attorney’s office in the District says the guard emigrated to the United States in 1946 and at some point moved to Ridgefield. He sold his house in 1962, leaving the painting behind, just as the couple who bought it from him did when they sold it in 1987 to David Tracy and moved to Arizona to retire. The Swiss guard died in 1986 with no heirs, federal prosecutors said

Gabby Tracy couldn’t help but wonder about the guard: “Could he have gotten this painting as a reward for getting some Nazi across [neutral Switzerland]?”

And she has thought about how he transported it. “The painting is so large I don’t know how in the world it got across to America,” she said.

The Tracys did not contest the U.S. government’s seizure of the painting under forfeiture law. On Thursday, the U.S. attorney for the District of Columbia filed a notice in court — United States v. One Painting Entitled Secret Departure of Ivan the Terrible Before the Oprichina.

It is the official forfeiture notice, and a way to make sure no one else claims ownership before the FBI gives the painting back to Ukraine.

In a statement, the Ukrainian Embassy said it is eager to get the painting back and also publicly thanked the Tracys “for their gesture to return the painting. . . .This is a perfect example where good will and art help to build stronger bridges between the nations.”

The assistant director in charge of the FBI’s Washington Field Office, Nancy McNamara, called the artwork important “not just for its monetary value, but for its place in the world of art and culture.”

Elizabeth Haynie Wainstein, owner of the auction house, said the painting’s history nearly went undiscovered.

At first, she said, the firm had difficulty determining where the artwork was from. Then a researcher found a reference to it in an old Russian publication that said the painting had been destroyed. It was not listed as stolen on registers kept in the art world.

The researcher put feelers out and heard back from the museum in Ukraine. It provided pictures of the painting hanging in an exhibit at the Dnepropetrovsk in 1929, when it was the Ekaterinoslav City Art Museum. It was also listed on an internal museum inventory of “museum artworks taken to Germany by the Hitlerites.”

Wainstein said the Internet has helped bring such stolen paintings to light, allowing repatriation. She also said that as people from the World War II era pass away, additional art is being found in estates.

“It’s important that these pieces be returned,” Wainstein said.

After enjoying the artwork for many years, Gabby Tracy agreed, saying she and her husband are “happy it is going back to where it belongs.”