Image copyright Reuters

Reports that Orlando gunman Omar Mateen had been a regular at the gay nightclub he attacked and used gay dating apps have led to speculation that he was motivated by internalised homophobia. But what is it, and could it have anything to do with the worst shooting in recent US history?

Investigators are still trying to establish what led a 29-year-old security guard from Florida to murder 49 people and injure dozens more as they partied in popular gay nightclub Pulse.

They are examining indications Mateen was inspired by radical Islamism, following revelations that he pledged allegiance to the Islamic State group and the FBI had investigated him twice previously for terror links.

Mateen's father also suggested his son had harboured strong anti-gay views, fuelling many people's belief that the attack was motivated by violent homophobia.

But as more information emerges about the killer's history, a more complicated picture is developing. Witnesses said Mateen had visited the Pulse club as a guest several times over the past three years and interacted with men on gay dating apps. His ex-wife, Sitora Yusufiy, told CNN it was possible he had hidden feelings about being gay.

It has led experts to question whether the gunman was spurred on - at least in part - by a powerful self-loathing about his own sexuality. Could he have been driven to hate and hurt others because he hated himself?

Media playback is unsupported on your device Media caption Jim Van Horn, Pulse nightclub customer: "He (Omar Mateen) was a homosexual and he was trying to pick up men"

"Although it is not common, it's not unheard of for people to be violent to other people who are LGBT (lesbian, gay, bisexual and transgender) as part of overcompensating for something that they are struggling with themselves," says Genevieve Weber, who has specialised in counselling people affected by internalised homophobia and now teaches counselling at Hofstra University in New York.

"It's could be part of the notion, 'If I differentiate myself enough, I can't be gay'."

Definitions of internalised homophobia vary, but it is essentially when LGBT individuals encounter negative beliefs in society towards the LGBT community, absorb those beliefs and accept them to be true.

Researchers say it happens involuntarily, and while Mateen would be a very extreme example, it is an issue that affects many LGBT individuals at some time in their lives.

Image caption Omar Mateen's ex-wife says he enjoyed clubbing and nightlife but that he did not want people to know that about him

"It's a really simple concept unfortunately," says Ilan Meyer, a senior scholar for public policy and sexual orientation law at the University of California, Los Angeles. "All members of society are taught about conventions. We learn about stigma and prejudices about certain groups from a very young age.

"So when a person begins to recognise that he or she is gay or lesbian, there is already that negativity."

Messages about homosexuality can come from multiple places, including family, school and the media, experts say.

Intolerance can be covertly communicated, perhaps through slurs or pejorative statements such as "that's so gay", or overtly, such as bullying or anti-gay teachings in religions that do not accept LGBT rights.

Image copyright AFP Image caption A man cries during a prayer against homophobia at a church in California, one of an increasing number of places of worship that are more open to LGBT people

"There are many religions that are not homophobic," says Meyer. "But in some cases, when you are religious and you hear negative messages repeatedly from people who are the most valued in your community it is going to be a very painful lesson.

"Certainly in the evangelical Christian community in the US, for example, if you went to church every week you could learn horrible things."

Sohail Ahmed, a young Muslim man from London, says his struggles with his own sexuality led him to become increasingly extreme in his religious views - to the extent that he even considered staging a terrorist attack.

"I would research all these Islamic verdicts on what you should do if you have homosexual feelings," he told the BBC's World Service.

"One thing would keep coming up again and again was that you need to be more religious, worship more.

"It sounds really paradoxical… but I actually became more radical in an attempt to cure myself of homosexuality."

Ahmed says he hid his true sexuality from everyone he knew, and even began to believe he was "evil".

"I started thinking maybe I was gay as a punishment from God for something I had done. It was an absolutely horrifying feeling - waking up every day with this voice at the back of your head saying you're disgusting, you're evil.

"It was this endless cycle. It just increased my hatred for myself and other gay people. It was extremely destructive."

Ahmed later denounced his extremist views and now helps others turn away from radicalism. He has come out as gay and follows a progressive branch of Islam that accepts LGBT people.

But experts warn that internalised homophobia can also have a harmful impact on a person's mental health. It can cause depression and anxiety, leave people feeling unable to form intimate relationships, and lead them to make unsafe choices.

Media playback is unsupported on your device Media caption BBC Pop Up helped Florida residents create a video message to the global gay community

"Internalised homophobia is not in itself a mental health problem, but it causes mental health problems," says Meyer.

"Certainly if you're dealing with that very hard period to accept yourself, it is very stressful. It can lead to drug or alcohol abuse. You might use drugs during sex to numb yourself to what you're doing."

People affected need to understand it is a condition that can be worked through, says Genevieve Weber.

"With the right help from a counsellor or someone that really understands, people can be brought to the point where they love themselves and realise there is a whole community who will support them."

Both Weber and Meyer say educating society as a whole is crucial to enabling people to avoid developing internalised homophobia and its potentially damaging effects.

"School environments need to not only be accepting, but also teach kids about gay and lesbian society," says Meyer. He also encourages anyone who might be struggling with their sexuality to look for positive stories and images online.

Weber says it is important that the right help is at hand. "It's about having people in roles where they are showing acceptance, and ensuring that you have clinicians trained in understanding the issues who are accessible to people."

It is not yet known for certain whether Mateen experienced internalised homophobia - and whether he ever tried to get support.

For his part, Meyer says there is not enough research to prove a direct link between internalised homophobia and violent behaviour.

"But I know that Mateen would not be the first person to display homophobia internally and externally."

Examples could include instances where conservative, anti-LGBT politicians have been "outed" by the media as gay or lesbian, he says.

But when it comes to the Orlando gunman, this is one of many questions that remain unanswered.