Lana Wachowski

Director Lana Wachowski, whose films include Cloud Atlas and the Matrix trilogy and who came out as transgender earlier this year, told an audience in San Francisco last weekend that she nearly committed suicide as a young adult because of her identity struggles.

"In the absence of words to defend myself, without examples, without models, I began to believe voices in my head — that I was a freak, that I am broken, that there is something wrong with me, that I will never be lovable," Wachowski said at the Human Rights Campaign's gala dinner in San Francisco, where she accepted the LGBT organization's Visibility Award.

Wachowski, who helmed the Matrix films with her brother Andy, said she struggled with acceptance her entire life, and recalled an incident in her Catholic elementary school where she was reprimanded by a nun after hesitating about whether to get in the boys' or girls' line.

WATCH: Matrix director debuts as transgender

As a high school student, Wachowski said, she wrote a four-page suicide note to her parents ("I really wanted to convince them that it wasn't their fault, it was just that I didn't belong") and got as far as the edge of a subway platform before fate intervened, in the form of an elderly stranger who wandered into the station.

"He stares at me the way animals stare at each other," Wachowski told the audience. "I don't know why he wouldn't look away. All I know is that because he didn't, I am still here."

Earlier this year, while doing promotion for Cloud Atlas, Wachowski appeared in public as a woman for the first time.

"When I was young, I wanted very badly to be a writer, I wanted to be a filmmaker, but I couldn't find anyone like me in the world and it felt like my dreams were foreclosed simply because my gender was less typical than others," she said during her speech. "If I can be that person for someone else, then the sacrifice of my private civic life may have value."

Watch Wachowski's full speech below, via The Hollywood Reporter: