Lena Dunham apologized on Saturday for defending a writer on her HBO show Girls, after some on social media slammed her for not believing a woman who accused him of sexual assault.

"I never thought I would issue a statement publicly supporting someone accused of sexual assault, but I naively believed it was important to share my perspective on my friend's situation as it has transpired behind the scenes over the last few months," the Girls actor, writer and director said.

"I now understand that it was absolutely not the time to come forward with such a statement and I am so sorry."

The social media backlash started Friday night, after the Hollywood Reporter published a story stating that Girls writer Murray Miller had been accused of sexual assault by actor Aurora Perrineau.

According to the story, Perrineau filed a report on the alleged incident with police in Hollywood.

Through his lawyers, Miller has denied the events.

"Mr. Miller categorically and vehemently denies Ms. Perrineau's outrageous claims," attorney Don Walerstein said in a statement. "After being contacted several weeks ago by lawyers who — on Ms. Perrineau's behalf — sought substantial monetary damages from him, Mr. Miller's legal team gathered overwhelming evidence directly contradicting these false and offensive claims."

Actor Aurora Perrineau had a small part in the 2016 Oscar winner Passenger and is the daughter of actors Harold Perrineau and Brittany Perrineau. (Hasbro via Associated Press)

Girls co-creators Dunham and Jenni Konner sent a statement to the Hollywood Reporter late Friday. Saying they had "insider knowledge" of the situation, they defended Miller and said the accusations were false.

"While our first instinct is to listen to every woman's story, our insider knowledge of Murray's situation makes us confident that sadly this accusation is one of the three per cent of assault cases that are misreported every year," they said.

"We stand by Murray and this is all we'll be saying about this issue."

Jennifer Konner, left, and Dunham arrive together for Variety's Power of Women luncheon in New York City in April 2017. (Brendan McDermid/Reuters)

Some on Twitter slammed Dunham for implying that Perrineau was lying.

"You don't have to automatically believe her & abandon your friend, but u will NEVER assume that his accuser must be lying because no matter how much u love your friend, U DON'T KNOW," tweeted writer Ijeoma Oluo.

Others accused her of hypocrisy, reminding Dunham of a tweet she had posted in August 2017: "Things women do lie about: what they ate for lunch. Things women do not lie about: rape."

On Saturday, Dunham said she believes all accusers should be heard and not immediately dismissed.

"Every woman who comes forward deserves to be heard, fully and completely, and our relationship with the accused should not be part of the calculation anyone makes when examining her case."

I avoid talking about Lena Dunham because life is too short. However, to deny an alleged sexual assault PUBLICLY, regardless of what “insider info” you have, is careless & selfish. If your friend is innocent, that will be proven. Your public statement hurts survivors. —@harikondabolu

Lena Dunham in Aug 2017: women don’t lie about rape.<br>Lena Dunham in Nov 2017: ...unless they’re accusing a friend of mine. <a href="https://t.co/GxLHrHUBFr">pic.twitter.com/GxLHrHUBFr</a> —@meghamohan