The police killed the gunman, who was identified as Omar Mateen, 29, a New York-born Florida resident and US citizen who was the son of immigrants from Afghanistan and had twice been questioned by FBI agents in recent years, authorities said.

Mateen's former wife described him as emotionally and mentally disturbed with a violent temper, yet who aspired to be a police officer. He also worked as an armed guard for the security firm G4S, the world's largest, according to the company.

Law enforcement officials were probing evidence suggesting the attack was inspired by Islamic State militants, although they said there was no proof that Mateen had worked directly with the group.

As the shooting rampage was unfolding, Mateen "made calls to 911 this morning in which he stated his allegiance to the leader of the Islamic State," said Ronald Hopper, the FBI's assistant special agent in charge on the case.

Shots rang out at the crowded Pulse nightclub in the heart of Orlando, one of the most popular US tourist destinations, as some 350 patrons were attending a Latin music event in conjunction with gay pride week celebrations. Clubgoers described scenes of terror and pandemonium, with one man who escaped saying he hid under a car and bandaged a wounded stranger with his shirt.

"Words cannot and will not describe the feeling of that," Joshua McGill said in a posting on Facebook. "Being covered in blood. Trying to save a guy's life."

Fifty-three people were wounded in the rampage. It ranked as the deadliest single U.S. mass shooting incident, eclipsing the massacre of 32 people at Virginia Tech University in 2007.

"We know enough to say this was an act of terror, an act of hate," Obama said in a speech from the White House. "As Americans, we are united in grief, in outrage and in resolve to defend our people."

US officials cautioned, however, they had no conclusive evidence of any direct connection with any foreign extremist group. "So far as we know at this time, his first direct contact was a pledge of bayat (loyalty) he made during the massacre," said a U.S. counterterrorism official. "This guy appears to have been pretty screwed up without any help from anybody."

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

The shooting was nearly certain to reignite emotional debates over American gun laws and homeland security in what is shaping up to be a vitriolic US Presidential campaign between Democrat Hillary Clinton and Republican Donald Trump.  

The attack came six months after a married couple in California - a US-born son of Pakistani immigrants and a Pakistani-born woman he married in Saudi Arabia, fatally shot 14 people in San Bernardino in an attack inspired by Islamic State. That couple died in a shootout with police hours after their attack on a holiday party attended by the husband's co-workers.

The Florida shooting evolved into a hostage situation, which a team of SWAT officers ended around dawn when they used armored cars to storm the club before killing the gunman. It was unclear when the victims were killed.

Officials in Orlando, a city of 270,000 people and home to tourist attractions including the Disney World resort, were visibly shocked at the high death toll, which they had initially put at 20.

"We're dealing with something that we never imagined and is unimaginable," Orlando Mayor Buddy Dyer said. He said 39 people died inside the club, two outside, and nine others died after being rushed to hospital.

Orlando Regional Medical Center hospital said it had admitted 44 victims, including nine who died, and had carried out 26 operations on victims. The city began releasing names of the victims on Sunday, with the first seven identified as Edward Sotomayor Jr., Stanley Almodovar, Luis Omar Ocasio-Capo, Juan Ramon Guerrero, Eric Ivan Ortiz-Rivera, Peter Gonzalez-Cruz and Luis Vielma.

Mateen had twice been interviewed by FBI agents, in 2013 and 2014, after making comments to co-workers indicating he supported militant groups, but neither interview led to evidence of criminal activity, the FBI's Hopper said.

Latest News from World News Desk