A gunman killed 50 people at a packed gay nightclub in Orlando, Florida on Sunday and wounded at least 53 others before being killed by police in the worst mass shooting in U.S. history. The Islamic State group claimed responsibility for the attack.

Orlando Mayor Buddy Dyer said the attack was the deadliest single U.S. shooting incident, eclipsing the 32 people killed in the 2007 massacre at Virginia Tech university.

The shooter was identified as Omar S. Mateen, a Florida resident who a senior FBI official said might have had leanings towards Islamic State militants. Officials called the rampage a "terrorism incident," but cautioned that the suspected Islamist connection required further investigation.

Open gallery view A screenshot of the Facebook post Pulse Orlando wrote amid the reported shooting. Credit: Screenshot / Facebook

A police officer working as a security guard inside the club, which has operated in downtown Orlando since 2004, exchanged fire with the suspect at about 2 A.M., police officials said.

A hostage situation quickly developed, and three hours later SWAT team officers used armored cars to storm the club before shooting dead the gunman. It was unclear when the gunman killed the victims.

One officer was injured after he was hit in his helmet while exchanging fire with the gunman, police said.

The attacker was carrying an assault rifle and a handgun, Orange County Sheriff Jerry Demings said. He was also carrying an unidentified "device," Orlando Police Chief John Mina said earlier.

The victims' bodies, said the mayor, were still in the club as families were informed and the identification process began. The local hospital said surgeries were ongoing and that some of the wounded were in critical condition.

Congressman Adam Schiff, the top Democrat on a congressional intelligence committee, said that Mateen had declared his allegiance to Islamic State, basing his assessment on information gleaned from local law enforcement.

"Do we consider this an act of terrorism? Absolutely," said Danny Banks, special agent in charge of the Florida Department of Law Enforcement. "Whether that is domestic terrorist activity or an international one, that is something we will certainly get to the bottom of."

An FBI spokesman says the mass shooting is being investigated as an act of terrorism. He says authorities are looking into whether this was an act of domestic or international terror, and if Mateen, who has been confirmed dead, acted alone.

Asked if the FBI suspected the gunman might have had inclinations toward militant Islam, including a possible sympathy for Islamic State, Ronald Hopper, an assistant FBI agent in charge, told reporters: "We do have suggestions that the individual may have leanings toward that particular ideology. But right now we can't say definitively."

The FBI said it was still trying to pin down whether the mass shooting was a hate crime against gays or a terrorist act.

U.S. President Barack Obama said after the attack that the shooting was "an act of terror, an act of hate." Following Obama's address, the Islamic State group's Amaq news agency said the attack "was carried out by an Islamic State fighter."

The violence erupted at a Latin-themed party attended by over a hundred people at Pulse nightclub, that urged patrons in a post on its Facebook page to "get out" and "keep running."

Under Pulse's Facebook post, commentators wrote that a "shooter with an assault rifle" opened fire at around 2 A.M. local time, before barracading himself "inside Pulse with multiple hostages."

"People on the dance floor and bar got down on the floor and some of us who were near the bar and back exit managed to go out through the outdoor area and just ran," an eyewitness commented on Facebook.

U.S. Senator Marco Rubio of Florida told CNN he understood that the gunman had worked for a security company and so would have undergone some background checks.

"Over the next couple of days they're going to be looking to see where this individual was inspired to carry out this horrifying act of terrorism," Rubio said. "I think we're going to be talking about a very different kind of case here soon."

Obama has ordered the federal government to provide any assistance necessary to local law enforcement officials investigating the incident.

The Orlando Fire Department's bomb squad and hazardous material team rushed to the scene of the attack. Videos posted on social media showed a large response by police and emergency vehicles outside the nightclub.

Orlando Police later tweeted that law enforcement carried out a controlled explosion at the scene.

The incident follows the fatal shooting late Friday of 22-year-old singer Christina Grimmie, who was killed after her concert in Orlando by a 27-year-old Florida man who later killed himself. Grimmie was a YouTube sensation and former contestant on "The Voice."