Gunman Omar Mateen, who killed at least 50 people in a gay nightclub in Florida, was mentally unstable and had a history of using steroids, his ex-wife said.

The 29-year-old, who wielded an assault-type rifle and a handgun, opened fire inside Pulse, in Orlando, spraying clubbers with bullets in the deadliest mass shooting in modern US history.

He was later killed in a shoot-out with police officers after taking hostages.

The police were investigating the attack - which left at least 53 other people in hospital, most of them critically ill, leading to fears the death toll would rise - as an act of terrorism.

Mateen made a 911 call from the club in which he professed allegiance to the leader of Islamic State, Abu Bakr al-Baghdadi, a law enforcement official said.

The extremist group did not officially claim responsibility for the attack, but the IS-run Aamaq news agency cited an unnamed source as saying the attack was carried out by an IS fighter.

Even if the perpetrator supported IS, it was unclear whether the group planned or knew of the attack beforehand.

Mateen was known to law enforcement. In 2013, he made inflammatory comments to co-workers and was interviewed twice, according to FBI agent Ronald Hopper.

He said in 2014, officials found that Mateen had ties to an American suicide bomber, but the agent described the contact as minimal, saying it did not constitute a threat at the time.

Asked if the gunman had a connection to radical Islamic terrorism, Mr Hopper said authorities had "suggestions that individual has leanings towards that".

His ex-wife, Sitora Yusufiy, told reporters that her former husband was bipolar and "mentally unstable".

The couple were together for only four months because he was abusive, she said in remarks televised from Boulder, Colorado, and the two had no contact for the last seven or eight years.

Mateen was short-tempered and had a history with steroids, she said.

Ms Yusufiy described him as religious but not radical, and said he wanted to be a police officer and applied to a police academy.

"He was mentally unstable and mentally ill," she said.

Mateen would not let her speak to her family, and relatives had to come and literally pull her out of his arms, she said.

Ms Yusufiy said she was "devastated, shocked, started shaking and crying" when she heard about the shooting, and she attributed the violence to his mental illness, not any alliance with terrorist groups.

Mateen, an American citizen from Fort Pierce, Florida, struck at around 2am local time on Sunday, shortly before the club was due to close.

His father recalled that his son recently got angry when he saw two men kissing in Miami and said that might be related to the assault.

Mateen's family was from Afghanistan, and he was born in New York, with his family later moving to Florida.

He had held a firearms licence since at least 2011 and worked as a security guard with G4S.

Mateen purchased at least two firearms legally within the last week or so, according to Trevor Velinor of the Bureau of Alcohol, Tobacco and Firearms.

President Barack Obama called the shooting an "act of terror" and an "act of hate" targeting a place of "solidarity and empowerment" for gays and lesbians. He urged Americans to decide whether this is the kind of "country we want to be".

In a separate incident, an Indiana man armed with three assault rifles and chemicals used to make explosives was arrested on Sunday in Southern California and told police he wanted to do harm to a gay pride parade.

The previous deadliest mass shooting in the US was the 2007 attack at Virginia Tech, where a student killed 32 people before killing himself.