I think it is a psychological condition because there is always something that triggers the persons brain that he/she is supposed to be a boy if she's a girl and vice versa.

homosexuality could also be triggered because of the people surrounding the person. if those people treat him as a girl, he'd probably think he is a she and vice versa.

hope my opinion helps