Williams was given Parkinson's diagnosis
Robin Williams had been diagnosed with Parkinson's disease before he took his own life, it has emerged.
The Oscar-winning actor and comedian was in the early stages of the disease, but had told only those closest to him.
Susan Schneider, his third wife, confirmed his condition in an emotional statement in which she described his "brave" fight.
"Robin's sobriety was intact and he was brave as he struggled with his own battles of depression, anxiety as well as early stages of Parkinson's disease, which he was not yet ready to share publicly," she said.
"It is our hope in the wake of Robin's tragic passing, that others will find the strength to seek the care and support they need to treat whatever battles they are facing so they may feel less afraid.
"Robin spent so much of his life helping others. Whether he was entertaining millions on stage, film or television, our troops on the front lines, or comforting a sick child, Robin wanted us to laugh and to feel less afraid.
"His greatest legacy, besides his three children, is the joy and happiness he offered to others, particularly to those fighting personal battles."
Williams had hidden his diagnosis from many who knew him. The night before he took his own life he had appeared in good spirits and was seen laughing as he discussed a possible new film project about a homeless superhero.
The actor had turned up unannounced with his wife at an art gallery reception in Fairfax, near San Francisco, a few miles from their home.
Williams, 63, spent an hour at the reception and photographs showed him, dressed all in black, socialising normally with other guests and not drinking.
He had been the first person to buy one of the sculptures of the artist Mark Jaeger, who makes giant superhero heads out of clay. They discussed Mr Jaeger's idea for a film script about a homeless person who performs good deeds at night.
Mr Jaeger told the Marin County Independent newspaper: "I said 'Robin, I'm enthused. I love the idea that it could be a movie but I don't know how to do that'. And he said, 'Oh, you just jot down some notes on a piece of paper'. And I said 'Then what'?
"And he said, 'Don't worry, I'll take care of it. I'll connect you with the right people'. He was so generous. I'm a nobody and he made me feel like my work is important."
Williams had reportedly fallen off the wagon, at least briefly, last year during filming of a scene for the television series The Crazy Ones, in which he played an advertising executive, at Spago restaurant, the New York Post reported. The scene depicted a business meeting and the star "insisted on a real drink," a source told the newspaper.
Williams had battled against alcohol addiction for his entire adult life, but had been sober since 2006. Friends also said he had been suffering from severe depression. According to one report, he had recently started sleeping 18 hours a day in a room with blacked-out windows.
Yesterday San Francisco police said the actor took his own life by hanging himself with a belt at his home. Marin County Sheriff's Lt Keith Boyd said Williams was found in a bedroom by his personal assistant .
Mr Boyd said toxicology tests would be performed and the investigation was ongoing.
The actor's death continues to touch his fans. Last night more than a thousand of his fans attended an open air screening of one of his most popular films in Dublin's Merrion Square. Fans queued for more than an hour to get a place for the special screening of "The Dead Poet's Society".