SAN FRANCISCO — A troubled gay Mormon man killed himself at an LDS Church after leaving a suicide note that said he hoped his death "might be the catalyst for some good."

Activists also say the man had recently written a lengthy letter expressing anguish over the church's condemnation of homosexuality and its support of an anti-gay marriage ballot measure.

The body of Stuart Matis, 32, Santa Clara, Calif., was found by an officer last Friday on a covered walkway behind The Church of Jesus Christ of Latter-day Saints building, said Sgt. Mark Macaulay, a police spokesman.

He said a gun was found beside the body.

A suicide note was read Wednesday night at a memorial service in an LDS church in Santa Clara. The San Francisco Examiner said Matis wrote in the note, found by his parents, that he had long prayed his sexual orientation would change but eventually gave up hope.

"I am now free," he wrote. "I am no longer in pain and I no longer hate myself. As it turns out, God never intended for me to be straight. Perhaps my death might be the catalyst for some good." A graveside service was scheduled for today at the Orem City Cemetery in Utah.

The suicide note did not mention Proposition 22, the measure on next Tuesday's ballot that would prohibit California from recognizing same-sex marriages that were legally performed in any other state. The LDS Church supports the measure, and its members have been the campaign's leading source of volunteers and money.

Matis' family, in a statement read at the service, asked that his death not be used for political gain. In a telephone call to his parents' home earlier in the day, his mother told The Associated Press that his death had nothing to do with Proposition 22.