ORLANDO, Fla. - A gunman who had declared his allegiance to ISIS opened fire inside a Florida nightclub early Sunday killing at least 50 people and injuring 53 more in the worst mass shooting in American history, officials said.

Authorities were investigating the attack at Pulse in Orlando as an act of terrorism, President Barack Obama said.

The suspect, Omar Mateen, a 29-year-old born in New York who lived in Fort Pierce, Florida, died in a gunfight with law enforcement officers as they broke into the club to rescue hostages, police said.

Orlando Mayor Buddy Dyer said all of the dead were killed with an assault rifle.

“There’s blood everywhere,” Dyer said at a news conference Sunday morning.

A federal law enforcement source with knowledge of the investigation said Mateen called 911 before the attack and declared his allegiance to ISIS. During the 911 call, he also mentioned the Boston Marathon bombings.

advertisement | advertise on newsday

The Islamic State’s Amaq news agency said the Islamist militant group claimed responsibility for the shooting, according to Reuters.

The FBI had investigated Mateen for possible ties to terrorists twice before, in in 2013 and 2014, FBI officials said in a news conference. But those investigations had been closed. Mateen’s father told reporters his son got angry when he saw two men kissing a couple of months ago.

About 2 a.m. Mateen, wielding an AR-15-type assault rifle and a handgun, opened fire at the crowded club, authorities said.

Those inside the nightclub described disbelief that turned to terror as patrons realized there was a gunman. Those who could scrambled out of the club and down residential streets, some carrying the wounded, according to videos posted online.

Three hours later police broke through a wall to save the people being held by Mateen.

The Orange-Osceola Medical Examiner’s Office in Orlando put out a call for medical examiners from around Florida to assist with autopsies.

“There’s too much volume for one office to handle,” said Danny Banks, head of the Central Florida office for the Florida Department of Law Enforcement.

Just before noon, three vans from the Medical Examiner’s office rolled in, one after the other, and pulled through gates in the walled parking lot behind the Orange County morgue.

advertisement | advertise on newsday

Family and friends desperate for information about loved ones were directed to a Hampton Inn & Suites in southern Orlando.

Sara Lopez said her longtime friend, Jimmy de Jesús Velázquez, had been lined up by a wall next to the bathroom when he was shot at the club, which is located in a hip neighborhood of shops, clubs, coffee shops and upscale apartments called SoDo for South of Downtown.

She said two of his friends at the club with him heard the shots and dropped to the floor and played dead, they told her.

“They saw when he started shooting at all the ones lined up on the wall,” Lopez said.

The two friends ran, she said, but Velázquez, 51, hasn’t been heard from again. She described him as the life of the party and a professional salsa dancer who had represented Puerto Rico in international contests.

advertisement | advertise on newsday

“I feel like my arms have been ripped off,” Lopez, 49, a resident of the nearby city of Casselberry, said in Spanish. “I am floating and don’t feel like I can walk or breathe.”

Obama, in remarks delivered Sunday afternoon, called the attack a “horrific massacre.”

“We know enough to say this is an act of terror and an act of hate,” he said, calling the gay nightclub “a place of solidarity and empowerment.”

The shooting was the most deadly attack in the U.S. since Sept. 11, 2001.

In New York, local police departments and state law enforcement increased security at LGBT events and other public gatherings. Organizations throughout the country are marking Gay Pride Month with parades and celebrations.

In 2013, the FBI investigated Mateen after he made “inflamatory comments” to co-workers in which he alleged terrorist ties, FBI Special Agent in Charge Ronald Hopper said. The FBI interviewed Mateen twice, watched him and spoke to witnesses but “was unable to verify the substance of his comments,” Hopper said.

In 2014, the FBI investigated Mateen’s potential connections to Moner Mohammad Abusalha, the first American to carry out a suicide bomb attack in Syria, the source said.

Abusalha at one point had lived in Fort Pierce.

The FBI has already interviewed dozens of people who’ve had contact with Mateen over the years, trying to learn more about his day-to-day life and path to radicalization, the source said.

The federal law enforcement source said that the federal law enforcement probes into Mateen led to some investigative leads and a paper trail the feds are now going back over as part of the nightclub shooting probe.

“We’re looking at everything,” the source said.

Mateen bought both firearms that he brought into the club legally in the past two weeks, said federal Bureau of Alcohol, Tobacco, Firearms and Explosives Special Agent-in-Charge Trevor Velinor. He would not say where the shooter purchased the guns.

The federal source said investigators believe Mateen received firearms training in the past in connection with his job at G4S.

The company said Mateen had worked there since 2007.

“We are shocked and saddened by the tragic event that occurred at the Orlando nightclub,” G4S said. “We can confirm that Omar Mateen had been employed with G4S since September 10, 2007. We are cooperating fully with all law enforcement authorities, including the FBI, as they conduct their investigation.”

Rolón said the shooter drove up to Pulse in a small sport utility vehicle or minivan and parked underneath the club’s street-level entryway.

Mateen fired the first shot at 2:02 a.m., officials said, and police arrived minutes later.

An off-duty Orlando police officer working security at Pulse was the first to return fire when the suspect began shooting, according to police spokeswoman Michelle Guido.

Pulse’s Facebook page posted an entry at 2:30 a.m. that said, “Everyone get out of pulse and keep running”

About 5 a.m., law enforcement agencies led by a SWAT team raided the club in force using vehicles and explosions to distract the shooter, officials said.

Orlando Police Chief John Mina said 11 officers were involved in the shooting. One of them, struck in his Kevlar helmet, suffered injuries to the head and forehead, Guido said. The officer was treated at Orlando Regional Medical Center, Guido said.

Three sheriff’s deputies also were involved in the incident. All 14 have been relieved of duty pending the outcome of shooting investigations by the Florida Department of Law Enforcement, officials said.

Another source said that police believe the shooter’s ex-wife had a Flushing address at one point and then moved to somewhere in New Jersey. The two married in 2009 and divorced in 2011.

Gov. Andrew M. Cuomo, said Sunday at the Puerto Rican Day Parade that state police would be on high alert. “We’ve gone ahead to err on the side of caution. We’re increasing the police presence in critical areas across the state,” he said.

New York Police Department Chief James O’Neill said that photos of the suspect have surfaced of him wearing NYPD shirts but that he has no connection to the department. New Yorkers can expect to “see increased uniform presence in nightlife throughout the city, in crowded venues,” he said.

Members of the lesbian, gay, bi-sexual, transgender and queer community were “reeling” from the attack.

“We are heartbroken and angry,” said a statement from Equality Florida. “Gay clubs hold a significant place in LGBTQ history. They were often the only safe gathering place and this horrific act strikes directly at our sense of safety.”

Imam Muhammad Musri, president of the Islamic Society of Central Florida, denounced Mateen’s actions, saying he did not represent the Muslim faith.

“This is not Islam. That’s not who we are,” he said. “We are a peaceful people.”

The gunman’s father, Mir Seddique, told NBC News that his son got angry when he recently saw two men kissing in Miami and had nothing to do with religion.

“They were kissing each other . . . and he [Mateen] said, ‘Look at that. In front of my son they are doing that,’ ” Seddique said.

The federal law enforcement source said that Mateen’s father has made politically charged statements in the past, including words in support of the Taliban.

Records show Seddique incorporated a business in Fla. called the Durand Jirga Inc., which the source says is a reference to a disputed area along the Pakistan/Afghanistan border.

Mateen’s family is from Afghanistan, the source said.

Rep. Peter King (R-Seaford), a member of the House Homeland Security Committee, said the incident shows that the United States needs to continue its terror fight.

“While all the facts are not known, we do know this was an ISIS connected attack,” King said. “The war against ISIS must be thorough and it will be long.”

U.S. Sen. Charles Schumer (D-N.Y.), following a news conference in his Manhattan office on college finances, said he was “breathless” when he heard the news.

He said that the event highlighted a failed effort to ban those on terror watch lists from buying firearms. “In this country it is so easy for people to get these types of assault-like weapons whose only purpose is to shoot a lot of people,” Schumer said.