Millions of Muslims each year make the arduous and exhausting haj pilgrimage to the holy city of Mecca in Saudi Arabia, but for one filmmaker, it was a journey that could have cost him his life.
The documentary "A Sinner in Mecca", which screened at the Sheffield Doc Fest on Sunday, follows Parvez Sharma, a gay Muslim living in New York, on his once-in-a-lifetime journey to a country where homosexuality is punishable by death.
For many Muslims, travelling to Mecca is the culmination of their entire lives, but for Sharma, who secretly filmed his pilgrimage on an iPhone, it was borne of a need to prove that he could reconcile his sexuality with his devotion to Islam.
Sharma said he was fortunate to be allowed into the conservative Islamic kingdom, despite his sexuality and a film career in which he has challenged conservative Islam.
"I was going back into the closet as a gay man, and also a filmmaker," said Sharma, who was publicly labelled an infidel in Saudi Arabia for his 2007 film "A Jihad for Love", which documented the lives of gay and lesbian Muslims worldwide.
"I was probably the most public Muslim homosexual on the planet... and my "sins" were very visible to anyone would care to simply search for my name online," Sharma told the Thomson Reuters Foundation at the annual film festival.
As a stark reminder of the chasm between Sharma's sexuality and his faith, the film opens with an exchange of distressed messages on a gay social network site between the filmmaker in New York and his friend Mo in the Saudi city of Medina.
In a frantic flurry of keystrokes, Mo recalls watching the beheading of a man in public, who he says was rumoured to have been executed because he was accused of being gay.
"Please help me get the out of this country it's hell. HELL. HELL. HELL," Mo says on the networking site.
The film not only follows the pilgrimage, but also explores Sharma's life with husband Dan in New York, and his troubled relationship with his late mother as a young man in India.
Having travelled to India at the end of his time in Mecca, Sharma reads various letters from his mother - who died of cancer when he was 21 - imploring him to find a wife.
"I always wonder 'Did the shame of my sexuality kill her? Am I the one who has sinned?'" Sharma asks himself in the film.
"Mother never forgave me for being gay. Her anger was relentless, and my shame eternal."
It is this shame that Sharma wrestles with as he narrates the pilgrimage which all Muslims must undertake once in their lives - to cleanse them of their sins in the eyes of Allah.
The filmmaker is wracked with doubt throughout his journey, often pondering if he will be accepted by Allah and denouncing contemporary Islam as at war with itself and having been "hijacked by a violent minority".
In one ritual of the haj, known as qurbani, Sharma kills a goat by slitting its throat, yet is overcome with remorse.
"By killing another living being, I have also killed part of myself. What is gone is the part of me that wondered if Islam would accept me... it is up to me, as a gay Muslim, to accept Islam," Sharma says as the film concludes.
Reflecting on what he refers to as the greatest journey of his life, Sharma talks about powerful moments where he felt completely alone despite being surrounded by millions of people.
"I felt I was making the pilgrimage on behalf of hundreds of thousands of gay Muslims who would never be able to go due to being too afraid. For me - it was my haj of defiance."