Maggie Gyllenhaal thinks prostitution should be decriminalised.

The 40-year-old actress plays a sex worker in her new TV show 'The Deuce' and she thinks it would be safer and healthier for everyone involved in the illicit industry if it was no longer a criminal act.

She said: ''Who needs a union more than a prostitute? I'm quoting David Simon (show creator) actually and I agree with him.

''My instinct is to say decriminalise it and make sure everybody's safe, healthy and taken care of. ''

Maggie - who has daughters Ramona, 11, and five-year-old Gloria with husband Peter Sarsgard - has a producer credit on the programme, which also stars James Franco, because she wanted to be involved in the ''storytelling process''.

She said: ''There was a little part of me that was concerned they weren't interested in telling the same story as I was interested in telling.

''That's why I asked to become a producer because I wanted to have some guarantee that I would be included in the storytelling process.

''The joke on set was, 'Maggie what kept you up last night?' There was always one thing that I would write a long email about at night. I would say, 'Here are the tiny things. If you don't do these, fine, but you must do this.' ''

And one topic the actress insisted on being shown on the show was her character masturbating or having sex away from her work.

She told Britain's ELLE magazine: ''I thought that would be, in some ways, an opening into her needs, her desire, her agency.

''I didn't hear anything about it for a long time. David Simon sort of joked with me, like, 'What? Really?' but he delivered a script with a storyline about Candy's own love life, and even includes her masturbating and having an orgasm that's both vulnerable and profound.

''It shouldn't, but somehow it seems radical to watch a woman whose job is a sex worker focusing on her own pleasure.''