NEW YORK — A former prominent neurological researcher at Yale and New York universities avoided prison time Wednesday for stealing research funds, but a judge said he must play piano for indigent elderly people in Connecticut to make amends.

The unusual sentence for Dr. Alexander Neumeister was handed out Wednesday by U.S. District Judge Analisa Torres.

Neumeister must play piano an hour at least twice weekly for the next three years at group facilities in Bridgeport, New Haven, Hartford and Waterbury, the Manhattan judge said. Torres said she saw in pre-sentencing materials that Neumeister is a trained pianist.

In June, Neumeister pleaded guilty to theft of government funds. He admitted stealing $87,000 from New York University and various grant programs from 2012 to 2014.

Prosecutors said he also was required to repay $76,000 after stealing money while he was at Yale from 2004 through 2010, though that was not part of the criminal case resulting in his plea.

Assistant U.S. Attorney Christopher Harwood said Neumeister was earning over $200,000 annually while he was spending pilfered money on flights, hotel rooms and dinners for himself, his family and others.

A tearful Neumeister apologized for shortsightedness and "poor judgment" and said his November 2017 arrest led him to confront his psychological demons.

He said he became a psychiatrist and neuroscientist specializing in the study of the brain and psychiatric illnesses long ago in part because "people close to me have lost their lives due to horrible circumstances concerning mental illness."

Defense lawyers wrote in a pre-sentence submission that Neumeister oversaw studies that sought discoveries to improve treatment for post-traumatic stress disorder and its effect on combat veterans, victims of sexual assault and war crimes, and those with addiction and anorexia.

His lawyer, Justine Harris, told the judge there was no easy explanation for what caused Neumeister to commit his crime.

"How could someone so gifted ... do something so clearly wrong, so stupid, frankly?" she said.

Neumeister has occasionally worked as a consultant since his arrest as he tried to confront the psychological and moral issues that led him to crime, Harris said.

He may return to his birthplace in Austria, she said, though the sentence was configured in a way that made it possible for him to remain in the United States.

Neumeister, a Hamden, Connecticut, resident, said he was committed to regaining "the integrity I have lost."

"I cannot help others if I do not help myself," he told the judge.