In the months before his death, Robin Williams was besieged by paranoia and so confused he couldn’t remember his lines while filming a movie, as his brain was ambushed by what doctors later identified as an unusually severe case of Lewy body dementia.

“Robin was losing his mind and he was aware of it. Can you imagine the pain he felt as he experienced himself disintegrating?” the actor’s widow, Susan Schneider Williams, wrote in a wrenching editorial published this week in the journal Neurology.

The title of her piece: “The terrorist inside my husband’s brain.”

Susan Williams addressed the editorial to neurologists, writing that she hoped husband’s story would “help you understand your patients along with their spouses and caregivers a little more.”

Susan Williams has previously blamed Lewy body dementia for her husband’s death by suicide in 2014. About 1.3 million Americans have the disease, which is caused by protein deposits in the brain. Williams was diagnosed with Parkinson’s disease a few months before he died; the telltale signs of Lewy body dementia in his brain were not discovered until an autopsy.

The editorial chronicles Williams’s desperation as he sought to understand a bewildering array of symptoms that started with insomnia, constipation, and an impaired sense of smell and soon spiraled into extreme anxiety, tremors, and difficulty reasoning.

“My husband was trapped in the twisted architecture of his neurons and no matter what I did I could not pull him out,” Susan Williams wrote.

For nearly a year, in a painful odyssey that will be familiar to many patients, Williams tried to find out what was wrong with himself — and fix it. He underwent tests and scans, tried new medications, did physical therapy, worked out with a trainer, and sought out alternative treatments like self-hypnosis and yoga.

“He kept saying, ‘I just want to reboot my brain,’” his widow recounted.

Nothing worked.

Susan Williams traced the first signs of trouble to a celebration of their wedding anniversary, about 10 months before her husband died, when “gut discomfort” made him fearful and anxious. That set off months of escalating problems.

Williams struggled particularly while filming “Night at the Museum 3” in the spring of 2014. He had a panic attack and had trouble remembering “even one line” in his role as Teddy Roosevelt. By contrast, Susan Williams wrote, he had remembered hundreds of lines without error while performing on Broadway three years before.

Susan Williams movingly described her husband’s rapid shifts in and out of clarity.

“I experienced my brilliant husband being lucid with clear reasoning 1 minute and then, 5 minutes later, blank, lost in confusion,” she wrote.

She added: “I was powerless in helping him see his own brilliance.”

After her husband’s death, Susan Williams wrote that she had many long conversations with doctors to retrace and understand what had happened to him. All four doctors who had reviewed his records, she said, “indicated his was one of the worst pathologies they had seen.”

Though she and her husband both craved a diagnosis during those bewildering months before his death, Susan Williams said in retrospect she is “not convinced that the knowledge would have done much more than prolong Robin’s agony” and turn him into “one of the most famous test subjects of new medicines and ongoing clinical trials.”

Williams has joined the board of the American Brain Foundation, a nonprofit that funds research on neurological illnesses.

“Hopefully from this sharing of our experience,” she wrote, addressing neurologists, “you will be inspired to turn Robin’s suffering into something meaningful through your work and wisdom.”

She added: “Do not give up.”

Republished with permission from STAT. This article originally appeared on September 29, 2016