Orlando, Florida (CNN)An American-born man who'd pledged allegiance to ISIS gunned down 49 people early Sunday at a gay nightclub in Orlando, the deadliest mass shooting in the United States and the nation's worst terror attack since 9/11, authorities said.

* Mateen called 911 during the attack to pledge allegiance to ISIS and mentioned the Boston Marathon bombers, according to a U.S. official.

* Orlando police shot and killed Mateen.

Read More

* Mateen's ex-wife said she thinks he was mentally ill.

Mateen carried an assault rifle and a pistol into the packed Pulse club about 2 a.m. Sunday and started shooting, killing 49 people and wounding at least 53, officials said.

After a standoff of about three hours, while people trapped inside the club desperately called and messaged friends and relatives, police crashed into the building with an armored vehicle and stun grenadesand killed Mateen.

JUST WATCHED

President Obama: 'This was an act of terror and hate'

MUST WATCH

Omar Mir Seddique Mateen was born in 1986 in New York. Most recently he lived in Fort Pierce, about 120 miles southeast of Orlando. Fearing explosives, police evacuated about 200 people from the apartment complex where he lived while they looked through his residence for evidence.

Mateen's parents, who are from Afghanistan, said he'd expressed outrage after seeing two men kiss in Miami, but they didn't consider him particularly religious and didn't know of any connection he had to ISIS.

Omar Mir Seddique Mateen

He was married in 2009 to a woman originally from Uzbekistan, according to the marriage license, but he filed documents to end the marriage in 2011.

Sitora Yusufiy, interviewed by CNN in Boulder, Colorado, said she and Mateen were together about four months, though it took a long time to complete the divorce because they lived in different parts of the country after separating.

Mateen was a normal husband at the beginning of their marriage but started abusing her after a few months, she said. She said Mateen was bipolar, although he was not formally diagnosed. She also said Mateen had a history with steroids. He was religious but she said she doesn't think his religion played in to the attack.

A message posted in Arabic on a dark web site associated with the ISIS news agency Amaq said "the armed attack that targeted a gay night club in the city of Orlando in the American state of Florida and that bore more than a 100 killed and wounded was carried out by an Islamic state fighter."

But CNN's Salma Abdelaziz, who translated the message and closely monitors ISIS messaging, cautioned about taking the message at face value.

She said the language is inconsistent with previous ISIS announcements and that the Arabic word for gay was used rather than an epithet normally used by ISIS. Also, there was no claim that the attack was directed, just an after-the-fact claim the gunman was an ISIS fighter, she said.

At a Sunday afternoon news briefing, FBI Assistant Special Agent Ronald Hopper said the agency was aware of Mateen. The FBI interviewed him in 2013 and 2014 after he expressed sympathy for a suicide bomber, Hopper said.

"Those interviews turned out to be inconclusive, so there was nothing to keep the investigation going," Hopper said.

CNN Map

Mateen was not under investigation at the time of Sunday's shooting and was not under surveillance, Hopper said.

In the past two weeks Mateen legally purchased a Glock pistol and a long gun, ATF Assistant Special Agent in Charge Trevor Velinor told reporters.

It's not known if those weapons were used in the attack.

"He is not a prohibited person. They can legally walk into a gun dealership and acquire and purchase firearms. He did so. And he did so within the last week or so," Velinor said.

Scene inside the club

Pulse describes itself as "the hottest gay bar" in the heart of Orlando. Hours before the shooting, the club urged partygoers to attend its "Latin flavor" event Saturday night. The club is a vast, open space that was hosting more than 300 patrons late Saturday and into Sunday morning.

People inside the cavernous nightclub described a scene of panic made more confusing by the loud music and darkness.

"At first it sounded like it was part of the show because there was an event going on and we were all having a good time," clubgoer Andy Moss said. "But once people started screaming and shots just keep ringing out, you know that it's not a show anymore."

Christopher Hansen said he was getting a drink at the bar about 2 a.m. when he "just saw bodies going down." He heard gunshots, "just one after another after another."

The gunshots went on for so long that the shooting "could have lasted a whole song," he said.

When the shots erupted, Hansen hit the ground, crawling on his elbows and knees, before he spotted a man who had been shot.

"I took my bandana off and shoved it in the hole in his back," Hansen said, adding that he saw another woman who appeared to be shot in the arm.

Photos:Orlando nightclub shooting

Police investigate the back of the Pulse nightclub in Orlando on Sunday, June 12. At least 49 people were killed there by Omar Mateen, who was shot and killed by Orlando police. It was the deadliest mass shooting in U.S. history.

Hide Caption

1 of 20

Photos:Orlando nightclub shooting

Bodies arrive at the medical examiner's office on June 12.

Hide Caption

2 of 20

Photos:Orlando nightclub shooting

Friends and family react after a list of hospitalized victims is released June 12 outside a hotel near the Orlando Regional Medical Center.

Police in Orlando direct family members away from the scene of the shooting.

Hide Caption

16 of 20

Photos:Orlando nightclub shooting

Shooting victims are attended to by emergency responders outside the club.

Hide Caption

17 of 20

Photos:Orlando nightclub shooting

Emergency personnel gather outside the nightclub.

Hide Caption

18 of 20

Photos:Orlando nightclub shooting

Bystanders wait at the scene.

Hide Caption

19 of 20

Photos:Orlando nightclub shooting

Police officers respond to the scene of the shooting.

Hide Caption

20 of 20

Survivors provided CNN with dramatic accounts of how they avoided death. One person hiding in the bathroom covered herself with bodies to protect herself. Some entertainers hid in a dressing room when the shooting started and escaped the building by crawling out when police removed the air conditioning unit.

One of the bartenders said she hid under the glass bar. Police came in and said, "If you are alive, raise your hand." Then police got her and others out.

After the initial shooting, police surrounded the club while Mateen was inside with clubgoers hiding in bathrooms and other parts of the building. People inside the club were communicating on their phones with law enforcement from that time until around 5 a.m., when authorities used an armored vehicle to break down the door of the building.

Hospital swamped with victims

Thirty-nine people and Mateen were pronounced dead at the scene, with two bodies found in the parking lot, Mayor Buddy Dyer said. Eleven people were taken to hospitals and pronounced dead there, he said.

Before Sunday, the deadliest shootings in U.S. history were at Virginia Tech in 2007 and Sandy Hook Elementary School in 2012, with 32 and 27 killed. Fourteen people were killed December 2 in an attack in San Berardino, California.

Photos:Worst mass shootings in U.S.

Photos:Worst mass shootings in U.S.

Police direct family members away from the scene of a shooting Sunday, June 12, at the Pulse nightclub in Orlando. A gunman opened fire at the club, killing 50 people and injuring at least 53, police said. It is now the deadliest shooting rampage in U.S. history.

Hide Caption

1 of 18

Photos:Worst mass shootings in U.S.

In December, two shooters killed 14 people and injured 21 at the Inland Regional Center in San Bernardino, California, where employees with the county health department were attending a holiday event. The shooters, Syed Rizwan Farook and his wife Tashfeen Malik, were later killed in a shootout with authorities. The pair were found to be radicalized extremists who planned the shootings as a terror attack, investigators said.

Hide Caption

2 of 18

Photos:Worst mass shootings in U.S.

Police search students outside Umpqua Community College after a deadly shooting at the school in Roseburg, Oregon, in October. Nine people were killed and at least nine were injured, police said. The gunman, Chris Harper-Mercer, committed suicide after exchanging gunfire with officers, a sheriff said.

Hide Caption

3 of 18

Photos:Worst mass shootings in U.S.

A man kneels across the street from the historic Emanuel African Methodist Episcopal Church in Charleston, South Carolina, following a shooting in June 2015. Police say the suspect, Dylann Roof, opened fire inside the church, killing nine people. According to police, Roof confessed and told investigators he wanted to start a race war. He pleaded not guilty to 33 federal charges in July.

Hide Caption

4 of 18

Photos:Worst mass shootings in U.S.

Police officers walk on a rooftop at the Washington Navy Yard after a shooting rampage in the nation's capital in September 2013. At least 12 people and suspect Aaron Alexis were killed, according to authorities.

Hide Caption

5 of 18

Photos:Worst mass shootings in U.S.

Connecticut State Police evacuate Sandy Hook Elementary School in Newtown, Connecticut, in December 2012. Adam Lanza opened fire in the school, killing 20 children and six adults before killing himself. Police said he also shot and killed his mother in her Newtown home.

Hide Caption

6 of 18

Photos:Worst mass shootings in U.S.

James Holmes pleaded not guilty by reason of insanity to a July 2012 shooting at a movie theater in Aurora, Colorado. Twelve people were killed and dozens were wounded when Holmes opened fire during the midnight premiere of "The Dark Knight Rises." He was sentenced to 12 life terms plus thousands of years in prison.

Hide Caption

7 of 18

Photos:Worst mass shootings in U.S.

A military jury convicted Army Maj. Nidal Hasan of 13 counts of premeditated murder for a November 2009 shooting rampage at Fort Hood, Texas. Thirteen people died and 32 were injured.

Hide Caption

8 of 18

Photos:Worst mass shootings in U.S.

Jiverly Wong shot and killed 13 people at the American Civic Association in Binghamton, New York, before turning the gun on himself in April 2009, police said. Four other people were injured at the immigration center shooting. Wong had been taking English classes at the center.

Hide Caption

9 of 18

Photos:Worst mass shootings in U.S.

Pallbearers carry a casket of one of Michael McLendon's 10 victims. McLendon shot and killed his mother in her Kingston, Alabama, home, before shooting his aunt, uncle, grandparents and five more people. He shot and killed himself in Samson, Alabama, in March 2009.

Hide Caption

10 of 18

Photos:Worst mass shootings in U.S.

Virginia Tech student Seung-Hui Cho went on a shooting spree on the school's campus in April 2007. Cho killed two people at the West Ambler Johnston dormitory and, after chaining the doors closed, killed another 30 at Norris Hall, home to the Engineering Science and Mechanics Department. He wounded an additional 17 people before killing himself.

Hide Caption

11 of 18

Photos:Worst mass shootings in U.S.

Mark Barton walked into two Atlanta trading firms and fired shots in July 1999, leaving nine dead and 13 wounded, police said. Hours later, police found Barton at a gas station in Acworth, Georgia, where he pulled a gun and killed himself. The day before, Barton had bludgeoned his wife and his two children in their Stockbridge, Georgia, apartment, police said.

Hide Caption

12 of 18

Photos:Worst mass shootings in U.S.

Eric Harris, left, and Dylan Klebold brought guns and bombs to Columbine High School in Littleton, Colorado, in April 1999. The students gunned down 13 and wounded 23 before killing themselves.

Hide Caption

13 of 18

Photos:Worst mass shootings in U.S.

In October 1991, George Hennard crashed his pickup through the plate-glass window of Luby's Cafeteria in Killeen, Texas, before shooting 23 people and committing suicide.

Hide Caption

14 of 18

Photos:Worst mass shootings in U.S.

James Huberty shot and killed 21 people, including children, at a McDonald's in San Ysidro, California, in July 1984. A police sharpshooter killed Huberty an hour after the rampage began.

Hide Caption

15 of 18

Photos:Worst mass shootings in U.S.

Prison guard George Banks is led through the Luzerne County courthouse in 1985. Banks killed 13 people, including five of his children, in Wilkes-Barre, Pennsylvania, in September 1982. He was sentenced to death in 1993 and received a stay of execution in 2004. His death sentence was overturned in 2010.

Hide Caption

16 of 18

Photos:Worst mass shootings in U.S.

Officers in Austin, Texas, carry victims across the University of Texas campus after Charles Joseph Whitman opened fire from the school's tower, killing 16 people and wounding 30 in 1966. Police officers shot and killed Whitman, who had killed his mother and wife earlier in the day.

Hide Caption

17 of 18

Photos:Worst mass shootings in U.S.

Howard Unruh, a World War II veteran, shot and killed 13 of his neighbors in Camden, New Jersey, in 1949. Unruh barricaded himself in his house after the shooting. Police overpowered him the next day. He was ruled criminally insane and committed to a state mental institution.

Hide Caption

18 of 18

National media attention was already focused on Orlando over the weekend because of Friday night's fatal shooting of Christina Grimmie while she signed autographs after a show. She was an up-and-coming singer who had appeared on NBC's "The Voice." Her shooter then killed himself. The Pulse shooting happened only a few miles from the Plaza Live theater, where Grimmie was killed.

Dyer, the mayor, called for the city to come together. "We need to support each other. We need to love each other. And we will not be defined by a hateful shooter," he said.

President Obama called for flags to be lowered to half staff and Florida Gov. Rick Scott called for a moment of silence across the nation at 6 p.m. Sunday. States of emergency were declared for the city of Orlando and for Orange County.

Santa Monica arrest

Also on Sunday, authorities in West Hollywood, California, arrested 20-year-old James Wesley Howell. They said they found an arsenal in his car that included, three assault rifles, high-capacity magazines, ammunition and a five-gallon bucket with chemicals that could be used to create an explosive device, officials said. At 5 a.m. PT, police got a call about a prowler and found Howell, who told authorities he was looking for a friend to attend the LA Pride festival.

JUST WATCHED

Police: Approx. 20 dead in Orlando nightclub shooting

MUST WATCH

Police on leave

Eleven Orlando police officers and three sheriff's deputies who exchanged gunfire with the suspect will be temporarily relieved of duty pending an investigation.

One officer suffered an eye injury when a bullet struck his Kevlar helmet, said Danny Banks, special agent in charge of the Florida Department of Law Enforcement's Orlando bureau. The helmet saved the officer's life, Banks said.

JUST WATCHED

Muslim leader to ISIS: 'You do not speak for us'

MUST WATCH

"This is a hate crime, plain and simple," CAIR National Communications Director Ibrahim Hooper said. "We condemn it in the strongest possible terms."

Nadine Smith of Equality Florida said groups are planning vigils around the nation. "It has just been a devastating day but people are starting to rally," she said.

Barbara Poma, owner of the Orlando nightclub Pulse, released the following statement on Sunday:

"Like everyone in the country, I am devastated about the horrific events that have taken place today. Pulse, and the men and women who work there, have been my family for nearly 15 years. From the beginning, Pulse has served as a place of love and acceptance for the LGBTQ community. I want to express my profound sadness and condolences to all who have lost loved ones. Please know that my grief and heart are with you."