Robin Williams' first wife reveals they had an arrangement that allowed him to be unfaithful.

Robin Williams and his first wife Valerie Velardi had an arrangement that allowed the actor to sleep with other women, a new documentary has revealed.

In an interview during Come Inside My Mind – a documentary about the actor, who took his own life in 2014 – Velardi explains that she would look the other way when it came to her husband’s affairs.

“He loved women. Absolutely loved women. And I got it,” she says in the documentary, which aired on HBO earlier this month.

“I understood and I wanted him to have that. But I also wanted him to come home.”

Watch the trailer for the documentary:

Williams and Velardi met in San Francisco in 1976 before the then-stand-up comedian had any of the acting credits that made him a household name.

They married in 1978 and welcomed a son, Zachary or ‘Zak’, in 1983. But in 1988 the pair divorced after Williams’ affair with Zak’s nanny Marsha Garces.

Garces gave birth to their first child together, Zelda, in July of 1989, the same year they married. And in 1991 they had son, Cody. However they too divorced in 2010 after being separated for more than a year.

Marsha Garces and Robin Williams in 1999 in New York City. Image: Getty

In October 2011, Williams married his third wife, a graphic designer, Susan Schneider, who was his partner when he died on 11 August 2014.

Schneider revealed shortly after his death that the 63-year-old had been diagnosed with Parkinson's disease. She said that the recent diagnosis, along with his long-time battles with depression and anxiety, contributed to his death. However, an autopsy later revealed he actually had a little known disease called Lewy body dementia.

Lewy body dementia is a progressive brain disorder characterised by microscopic protein deposits, called Lewy bodies, that develop on the brain and is often misdiagnosed as Parkinson’s disease or Alzheimer’s.

Come Inside My Mind features interviews from famous faces who knew Williams professionally and personally and explores his career, as well as his struggles with sobriety and mental illness.