People become homosexuals because of their environments. Particularly critical is the environment during puberty. If these conclusions are accompanied by actual homosexual acts they are even more strongly reinforced. Human instincts can be subjected to acts of will. Sexuality is a choice of identity which follows choices of action which follow from choices of what to have sexual fantasies about.
Human beings are especially able to control their thoughts, entertaining some and dismissing others.
As he repeatedly chooses to do so the evidence mounts and the idea becomes fixed in his identity. It may even have physical manifestations and change his physiology and psychology. This process can easily occur for any idea good or bad about the self which is based largely on evidence resulting from ones own action. There may be long time delays between the causing choices and the effects but anyone can change themselves. In all these sins prevention is 1000 times better than cure and much easier.