Yes, the judge did overstep the bounds with the "medical" opinion from scripture, I agree.
Had he held an opinion from medical personnel, that would have been helpful to his arguement, but then based on the support of scripture stating homosexuality is detrimental to society, he offered an opinion for those to seek help - same as if an alcoholic or drug abuser would come before his bench and be told to seek help with their problem....
Az