A homophobic ISIS sympathizer killed at least 50 people and wounded 53 others during a rampage at a gay nightclub in Florida early Sunday — marking the country’s deadliest mass shooting.

Omar Mateen, 29, called 911 and pledged his allegiance to ISIS and mentioned the Boston Marathon bombings early on in his bloodbath, according to reports.

Mateen, who worked as a security officer, was armed with an AR-15-style assault rifle and a pistol that the feds say he bought “in the past few days” when he started spraying bullets at about 350 patrons inside the Pulse dancehall around 2 a.m., officials said.

An off-duty cop working as a security guard at the club returned fire, prompting Mateen to retreat further into the hotspot and take hostages, officials said.

Mateen barricaded himself in a room with about five to eight hostages, said Orlando Mayor Buddy Dyer.

The madman held cops at bay for about three hours, until authorities used an armored vehicle to burst through the wall of another room that held about 15 to 25 people, Dyer said.

A furious gunfight with 11 SWAT team members followed, during which Mateen was killed and a cop was saved from death when a shot struck his Kevlar helmet.

ISIS claimed responsibility for the attack in a statement released by its Amaq news agency, saying the onslaught “was carried out by an Islamic State fighter,” Reuters reported. Three US officials said no evidence linking the massacre to any terror group had yet been uncovered.

The FBI said Mateen had twice been investigated for possible terror ties but that the results were inconclusive. One probe involved contact that Mateen had with a fellow Floridian who became the first American suicide bomber to strike in Syria.

Survivors described desperately hiding from the killer and jumping out of his way as he barreled toward them, gunning down victims. “This guy wanted to kill all of us,” Jeannette McCoy, 37, told The Post. “He wouldn’t stop shooting. It was like he was at a gun range.’’

President Obama called the attack “especially heartbreaking” and ordered White House flags flown at half-staff in memory of the victims. “We know enough to say that this was an act of terror and an act of hate,” he said. “And as Americans we are united in grief, in outrage and in resolve to defend our people.”

Online videos revealed that Mateen’s father, an Afghan immigrant, once hosted an anti-American TV show and called the Taliban “our warrior brothers.” The dad, Seddique Mateen, also posted a Facebook video around the time of his son’s rampage in which he wore combat fatigues and saluted the camera while urging Afghan unity.

The death toll from Mateen’s massacre included 39 people who were fatally shot inside and two outside, Dyer said. Nine others died after being rushed to the hospital, he said.

It appeared that Mateen acted as a lone wolf, with Tampa FBI Assistant Special Agent in Charge Ronald Hopper saying, “At this time, we do not have a second suspect that we are looking for.”

Hopper said there were also “no credible threats” regarding possible related attacks.

Mateen was briefly married in 2009, and three FBI agents were spotted visiting his former father-in-law’s home in Edison, NJ.

Mateen’s father told NBC that his son recently got “very angry” at the sight of men kissing each other in Miami and said his anti-gay fury might have triggered the massacre.

His ex-wife, Sitora Yusufiy, who now lives in Boulder, Colo., told reporters that she was “shook off the ground” when she learned of Mateen’s rampage and described how her family had “rescued” her from his abuse after about four months of marriage.

“In the beginning, he was a normal human being … but a few months after we married, I saw his instability,” she said.

Sheo said her ex-husband — who posted selfies in which he wore a golf shirt and T-shirt emblazoned with NYPD logos — had wanted to become a cop.

After the young couple’s divorce, Mateen remarried and fathered a young son, according to his dad.

The elder Mateen told NBC that his son’s rampage “has nothing to do with religion,” and suggested it was motivated by anti-gay hatred.

“We were in downtown Miami, Bayside, people were playing music. And he saw two men kissing each other in front of his wife and kid and he got very angry,” he told the network.

“They were kissing each other and touching each other, and he said, ‘Look at that. In front of my son they are doing that.’ And then we were in the men’s bathroom, and men were kissing each other.”

“We are saying we are apologizing for the whole incident,’’ the dad said, referring to his family. “We weren’t aware of any action he is taking. We are in shock like the whole country.”

Last month, an audio message purportedly issued by ISIS’ spokesman called on the terror group’s followers to launch attacks inside the US and Europe during the Islamic holy month of Ramadan, which began June 5.

“Ramadan, the month of conquest and jihad. Get prepared, be ready…to make it a month of calamity everywhere for the non-believers,” said the statement attributed to Abu Muhammad al-Adnani and distributed via Twitter accounts associated with ISIS.