A Sinner in Mecca is proving to be the most controversial film at this year's Hot Docs festival in Toronto.

For Indian-born, New York-based, openly gay Muslim filmmaker Parvez Sharma, it was a film he just had to make, despite the enormous risks.

"The Hajj is the highest calling for any Muslim," he told CBC News. "For years I felt I really needed to go, so this film is about me coming out as a Muslim. I'm done coming out as a gay man."

Undercover in Saudi Arabia

Sharma, whose first film, A Jihad for Love, premiered in 2008, made his new one by going undercover in Saudi Arabia.

A Sinner In Mecca

Parvez Sharma takes a selfie on his iPhone at the Kaaba during his Hajj pilgrimage. (© Haram Films, 2015)

He videotaped his journey to Mecca surreptitiously on his iPhone and other small cameras that looked like phones since filming isn't permitted in Saudi Arabia and homosexuality can be punished by death.

"I was terrified because they reserve the death penalty for people like me," Sharma said.

Several times he had his equipment seized and video files deleted by authorities. But he persevered with both his spiritual journey and his film.

"I was there making this pilgrimage for the thousands of gay Muslims who were too scared to go to Saudi Arabia, who would feel they would never be welcome," Sharma said. "I felt I was doing it for them."

Death threats

A Sinner in Mecca has its world premiere tonight in Toronto, but before it has even been seen, the film's very existence has earned Sharma hate mail and death threats from angry Muslims.

The film was also denounced by the Iranian government for promoting homosexuality. The Hot Docs festival has added extra security for the filmmaker's safety and for patrons attending the three sold-out screenings.

"I think I carry it as a weight on my shoulders," explains Sharma, "a heavy burden because I really want Muslims to embrace this film."

Sharma insists he didn't make the film as a provocation but he hopes it will help lead to social change.  

"I feel the film is a call to action to all Muslims," he said, "to change the things that need to change within 21st Century Islam. We're running out of time."

The Hot Docs Canadian International Documentary Festival runs through May 3.

Watch our interview with Parvez Sharm in the video above.