Facebook has been targeting young LGBT people with “predatory” 'gay cure' adverts, a Telegraph investigation has found.

The social media company has removed the posts after the Telegraph exposed a flaw with its micro-targeting algorithm.

LGBT users complained they were confronted with adverts promoting "sexual purity" and conversion therapy for gay and lesbian people because of the pages they have shown an interest in.

When users clicked on the "why am I seeing this ad" button on the advert it said Facebook had noticed they were interested in "gender issues."

Companies are able to direct their adverts at Facebook users who are most likely to be interested in their product.

Two gay conversion adverts the Telegraph reported to Facebook were pushed to people who were likely to be young and LGBT.

Charities accused Facebook of preying on members of vulnerable communities and urged Facebook to tighten its regulation on micro-targeting.

One lesbian woman was shown a video entitled “Homosexuality Was My Identity”, aimed at promoting “harmful” conversion therapy, because she had 'liked' LGBT pages on Facebook.

Tessa Ann Schwarz complained to the company, saying that the video was “really upsetting”, and said: “I don’t know why Facebook has permitted this group to target LGBTQ people, who have intentionally sought out community and education amongst peers, for shaming and hatred masked as love.”