Orlando - A gunman wielding an assault-type rifle and a handgun opened fire inside a crowded Florida nightclub early Sunday before dying in a gunfight with SWAT officers, police said.
The attack left at least 50 people dead, making it the worst mass shooting in American history.
Authorities were investigating it as an act of terrorism.
At least 53 other people were hospitalised, the Orlando mayor said.
"There's blood everywhere," Mayor Buddy Dyer said.
The suspect exchanged gunfire with an officer working at the gay club known as Pulse Orlando around 02:00, when more than 300 people were inside. The gunman then went back inside and took hostages, Police Chief John Mina said.
Around 05:00, authorities sent in a SWAT team to rescue the hostages. Police have not determined an exact number of casualties, but Mina said "approximately 20" bodies were inside the club.
In addition to the guns, the shooter also had some sort of "suspicious device," Mina said.
Authorities were looking into whether the attack was an act of domestic or international terror, and if the shooter acted alone, according to Danny Banks, an agent with the Florida Department of Law Enforcement.
"This is an incident, as I see it, that we certainly classify as domestic terror incident," Orange County Sheriff Jerry Demings said.
The suspect was identified as Omar Mateen of Port St Lucie, Florida.
FBI agent Ron Hopper, when asked if the gunman had a connection to radical Islamic terrorism, said authorities had "suggestions that individual has leanings towards that".
Police had said previously on Twitter that there was a "controlled explosion" at the scene of the shooting. Mina said that noise was caused by a device intended to distract the shooter.
A woman who was outside the dance club early on Sunday was trying to contact her 30-year-old son, Eddie, who texted her when the shooting happened and asked her to call police. He told her he ran into a bathroom with other club patrons to hide. He then texted her: "He's coming."
"The next text said: 'He has us, and he's in here with us,'" Mina Justice said. "That was the last conversation."
Dozens of police vehicles swarmed the area around the club. At least two police pickup trucks were seen taking what appeared to be shooting victims to the Orlando Regional Medical Center.
Pulse posted on its own Facebook page around 02:00: "Everyone get out of pulse and keep running." Just before 06:00, the club posted an update: "As soon as we have any information, we will update everyone. Please keep everyone in your prayers as we work through this tragic event. Thank you for your thoughts and love."
Local, state and federal agencies were investigating.
President Barack Obama was briefed on the attack and has asked for regular updates on the investigation, the White House said.
The attack follows the fatal shooting late on 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.
'The music stopped'
Jon Alamo said he was at the back of one of the club's rooms when a man holding a weapon came into the front of the room.
"I heard 20, 40, 50 shots," Alamo said. "The music stopped."
Club-goer Rob Rick said the shooting started just before closing time.
"Everybody was drinking their last sip," he said.
He estimated more than 100 people were still inside when he heard shots, got on the ground and crawled toward a DJ booth. A bouncer knocked down a partition between the club area and an area in the back where only workers are allowed. People inside were able to then escape through the back of the club.
Christopher Hansen said he was in the VIP lounge when he heard gunshots. He continued to hear shooting even after he emerged and police urged people to back away from the club. He saw the wounded being tended to across the street.
"I was thinking, 'Are you kidding me?' So I just dropped down. I just said, 'Please, please, please, I want to make it out,'" he said. "And when I did, I saw people shot. I saw blood. You hope and pray you don't get shot."