Image copyright AP

The worst mass shooting in modern American history was also a hate crime against the gay community. It's not the first time LGBT (lesbian, gay, bisexual and transgender) people have been the targets of violence.

There is still much to learn about what led 29-year-old Omar Mateen to murder 49 patrons at the Pulse Nightclub in Orlando, Florida. On Sunday, police said 50 people had been killed. However, on Monday, they changed that figure to 49, to exclude the gunman from the death toll.

President Barack Obama did not hesitate to condemn the massacre as "an act of terror and an act of hate".

"This is an especially heartbreaking day for all our friends - our fellow Americans - who are lesbian, gay, bisexual or transgender," he said in an address to the nation. "The shooter targeted a nightclub where people came together to be with friends, to dance and to sing, and to live."

The Orlando attack is a painful reminder that even though the US has made historic strides in broadening the rights of its LGBT citizens - like the legalisation of gay marriage in June 2015 - the struggle up until this point has been a difficult and sometimes violent one.

Image copyright Reuters Image caption A year ago the White House was lit up in rainbow colours to mark the Supreme Court's ruling on gay marriage

Seattle's openly gay mayor Ed Murray says the struggle for equal rights has usually seen moments of progress followed by a violent reaction.

"Americans woke with the sickening, all-too-familiar feeling of fear that our community has once again been attacked. For too long, our community has been the target of violence throughout the world," he said.

Nicholas Syrett, co-chair of the Committee on LGBT History and a professor at the University of Northern Colorado, said more openness came with a cost:

"Those who still remain intransigent in their hostility and opposition to gay people, they're going to be exposed to more of them because we are increasingly able to be open."

Image copyright AFP/Getty Images Image caption Protesters demand change after the murder of Matthew Shepard, a young gay man, in 1998

Until the shooting in Orlando, the largest mass death at a gay club was the arson attack at the UpStairs Lounge in New Orleans, Louisiana, in 1973. Thirty-two people died after an unknown assailant firebombed the entrance to the second-floor club, trapping people inside.

Like many of the patrons at Pulse Nightclub in Orlando, the revellers at the UpStairs Lounge were celebrating Pride Weekend.

In more recent history, in 2014, a Seattle man set fire to a stairwell at a gay bar called Neighbours, claiming "what these people are doing is wrong". No-one was killed.

In 1997, Eric Rudolph bombed a lesbian bar in Atlanta, injuring five.

Mr Syrett said that while large-scale attacks on the LGBT community were not as common, there had been hundreds of individual assaults and murders, including the high-profile beating death of Matthew Shepard in Wyoming in 1998.

Image copyright AP Image caption The injured receive treatment outside the Admiral Duncan pub in London

Similar attacks have taken place internationally as well - in 1999, a nail bomb killed three people and injured dozens more at the Admiral Duncan pub, in the heart of London's gay community. The culprit was a right-wing extremist.

There have also been documented executions of gay people in territory controlled by the so-called Islamic State (IS). Those accused of being LGBT are thrown from the roofs of buildings or stoned to death.

"Isis [another name for IS] are also professional when it comes to tracking gay people. They hunt them down one by one," wrote one man who fled IS in Iraq in an essay for BBC News. "They are trying to track down every gay man. And it's like dominoes. If one goes, the others will be taken down too."

In Orlando, Mateen was said to have called the emergency number 911 to pledge his allegiance to IS just before launching his attack.

Mark Wallace, CEO of the Counter Extremism Project, said it was difficult to know how many LGBT men and women had been killed by IS, but the practice was well documented.

Media playback is unsupported on your device Media caption IS's targeting of gay people is supported by many who oppose the group says one man who fled Syria - his words are spoken by an actor

"The targeting, persecution and killing of LGBT [people] in Isis-controlled territory is extensive.

"LGBT people have been suffering at the hands of extremists in various cultures and parts of the world for some time."

Though Mr Wallace said he did not want to diminish the suffering of the gay community, he added that the attacks in Orlando were about much more than an opposition to homosexuality.

"Isis and extremist ideology hate all of us," he says. "It's really an attack on all of us. It's an attack on the way we live - our openness."