Michael Glatze seemed quite sure of himself.

He was serving as the managing editor of XY magazine, a popular gay San Francisco-based publication that dispensed invaluable advice to men on how to survive young and gay. He was fascinated by queer theory and disturbed by Christian fundamentalism. He was in a loving relationship with fellow XY editor, Benjie Nycum. On the weekends, the two would go out to raves and enjoyed being gay and liberated. They even shared a home with a third man they’d picked up during a brief stay in Nova Scotia. Glatze and Nycum eventually left XY and started the non-profit Young Gay America, aimed at shaping the lives of gay youths for the better, before launching the magazine Young Gay America (YGA), which was awarded the National Role Model Award from the gay organization Equality Forum. The two lovers toured the country filming Jim In Bold, billed as the first major documentary to tackle the suicide epidemic among gay teens.

And then—out of the blue—Glatze became a born again Christian and renounced his homosexuality. “Homosexuality, delivered to young minds, is by its very nature pornographic. It destroys impressionable minds and confuses their developing sexuality; I did not realize this, however, until I was 30 years old,” Glatze wrote on the right wing website WorldNetDaily. “It became clear to me, as I really thought about it – and really prayed about it – that homosexuality prevents us from finding our true self within. We cannot see the truth when we’re blinded by homosexuality.”

The confounding story of Glatze is dramatized in the film I Am Michael, which made its world premiere at the 2015 Sundance Film Festival. It’s adapted from The New York Times Magazine story “My Ex-Gay Friend” by Benoit Denizet-Lewis, directed by first-time filmmaker Justin Kelly, and stars James Franco as Glatze, Zachary Quinto as his ex-lover, Bennett (the name was changed for the film), and Emma Roberts as Glatze’s eventual bride, Rebekah Fuller.

Kelly was a protégé of Gus Van Sant’s, having worked as an editorial assistant on the film Milk—a movie that co-starred Franco. “I saw a lot of James naked,” jokes Kelly, mentioning two intense gay sex scenes that were cut from the film. But the budding filmmaker and actor didn’t meet until years later at the behest of Van Sant, who’d sent Franco Denizet-Lewis’ Glatze story suggesting it would make an interesting film. After Franco gained the rights to adapt the story and acquired Glatze’s life rights and approval, Van Sant showed him Kelly’s short film, Front, and he was immediately sold on how naturalistic and effortless the performances were.

It’s the latest in a long line of gay-themed films for Franco who, unlike stars such as Kevin Hart who openly refuse to play gay, is one of the few Hollywood A-listers that regularly lends his name to cinematic explorations of homosexuality.

“I have a lot of different connections and interests in queer themes and characters who are gay, or part of this community,” says Franco. “I’m always trying to find projects or subject matter that reflects who we are, our time, and makes moves against certain tacit beliefs or heteronormative ways of thinking and institutions. Sometimes the subject matter aligns with my M.O. as a creative person to question and defy categorization, and this movie does that.”

“There’s no better ally than someone who’s not afraid of being perceived as gay,” adds Kelly.

I Am Michael opens with a present-day Glatze (Franco) questioning one of his young Bible students’ homosexual urges. Then, it flashes back to him lying in bed with his lover Bennett (Quinto). The first half of the film covers Glatze’s life as a gay and proud man, including giving a voice to the disenfranchised at XY, the couple’s relationship struggles while living in Nova Scotia, and Glatze picking up Tyler (Charlie Carver) while cruising one night at a gay bar—leading to a brief three-way sex scene that gives the relationship some spark again.

Much of the early press surrounding the film has focused on that three-way sex scene—thanks in part to a leaked image of the three going at it.

“It seemed like a balancing act for Justin,” says Franco. “Showing the three-way relationship and then skirting around it would be perceived as wimpy, and showing too much sex would be perceived as gratuitous, or would take over the movie.”

The second half of the film covers Glatze’s health scare, with the activist suffering from severe heart palpitations. Worried that he’s been afflicted by the same heart disease that took his father’s life when he was 13, he undergoes a series of examinations that determine it’s just a case of anemia caused by celiac disease. Following the episode, he decides to turn to Jesus and publicly renounces his homosexuality via a series of problematic articles and interviews.

“This, again, is my story. And in my story, it makes me repulsed to think about homosexuality,” Glatze wrote for WorldNetDaily. “And when I step back a little bit, I know why! Because people are supposed to feel like homosexuality is gross, because such a feeling prevents them from wanting to do it. And people are supposed to not want to do it, because doing it is something that prevents them from having babies, and having babies is something that we – naturally – are supposed to want to do, for human beings to survive. And, so, it’s obvious why people should feel gross about homosexuality. It’s not ‘wrong’ for people to think it’s gross. It makes sense!”

Bennett (a.k.a. Nycum) keeps the communication lines open, but the rest of the gay community brands Glatze persona non grata for his incendiary, anti-gay rhetoric. So, Glatze decides to join the Mormon Church, but the two have a falling out over their respective interpretations of the Bible. Then he really loses it.

In an episode that’s not depicted in the film, Glatze wrote on his personal blog back in 2008: “Have I mentioned lately how utterly disgusting Obama is? And, yes, it’s because he’s black. God, help us all.” And, following widespread criticism from the "converted" community, Glatze chose to circulate an email announcing his retirement as an ex-gay spokesperson. “After a lot of praying, I have decided I am NOT meant to be a spokesperson for the cause of healing from homosexuality… God has given me deliverance from the homosexual sin – but, He is not asking me to stand on a platform, as an activist, against my former lifestyle.”

“He can be a bit of an extremist,” Kelly says. “When he was gay he had to be a gay activist, and when he worked at a magazine he had to start his own magazine. So when he first became Christian and straight he wrote a lot of really hateful stuff. That’s why some people have been afraid of the movie, or have questioned why we’d give him a voice. But the film is about so much more than gay men becoming straight. It’s about identity, why we label one another, why people want to be a part of a group, and the power of belief.”

In an ironic twist, Glatze moves to Wyoming—just an hour and a half from where Matthew Shepard was brutally murdered—and studies to become a fundamentalist preacher. There, he meets Rebekah (Roberts), who accepts his conflicted past and pledges herself to him.

The real-life Glatze, meanwhile, was on hand at Sundance to see the film, and seemed to take it in stride.

“He thanked all of us, and it seemed like the movie was already—and will continue to be—a tool to help him heal,” Franco says. “I think this movie has shown him a way to still be the person he wants to be today without destroying the person he was before.”