Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

The gunman who killed 49 people at a gay nightclub in Orlando Sunday had twice taken a test used to possibly become a Florida law enforcement officer, and passed on the second attempt.

Omar Mateen failed in his first attempt at the law enforcement Basic Abilities Test on June 24, 2011, according to Florida Department of Law Enforcement records.

Mateen retook the test in 2014 and passed, making him eligible to enter a law enforcement academy, and possibly later become a police officer in Florida.

Mateen, 29, was killed by police after opening fire inside the Pulse nightclubearly Sunday. President Barack Obama called the shooting an act of terrorism and hate. The attack was the deadliest mass shooting in modern American history.

Related: No Psych Exam for Orlando Shooter Despite Odd Behavior, FBI Probes

Authorities are still investigating a motive, but Mateen’s father said he had in the past expressed anger at the sight of two men kissing. Mateen also called police during the attack and standoff and pledged allegiance to the leader of the terror group ISIS, law enforcement officials said.

Mateen was the subject of two FBI inquiries into Mateen in 2013 and 2014, including one full-blown investigation. The FBI investigation would have played no role in his ability to take the law enforcement test, as the results would not have been shared or available.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Mateen had worked as a security guard. The FBI probes came after Mateen boasted to colleagues of having ties to terror groups Al Qaeda and Hezbollah.

The comments to colleagues did prompt officials at a St. Lucie County courthouse to demand the security company remove him from a team of armed security guards there, and Mateen was transferred to a Port St. Luice resort.

Although Mateen failed the law enforcement test in 2011, the failing score was later changed to a passing one following changes to the test made by the Department of Justice and retroactive re-scoring, according to the records.

Related: Orlando Gunman and Wife Exchanged Texts During Rampage

The Department of Justice, Office of Civil Rights, found that the test Mateen took in 2011 through the vendor I/O Solutions had certain items on the test forms that "disproportionately affect African-American and Hispanic test takers."

The change was ordered in February of 2016. The change impacted roughly 6,500 test takers, including Mateen. By the time the change was made, Mateen had already passed the test when he retook it in 2014.

Mateen was employed by the Florida Department of Corrections beginning in October 2007, but was involuntarily dismissed in April of 2007, the department said. He didn't complete the academic program and was never certified as a corrections officer.

"Omar Mateen was not fit to serve as a member of the FDC team, as he was unable to meet the basic requirements of the correctional officer academy," the department said in a statement Friday.

Also Friday, a senior law enforcement official said investigators have so far not found a gay dating app on Mateen’s cell phone.

Some men in Orlando have said that they received messages from Mateen through various dating apps, but some of those have turned out to be cases of mistaken identity, investigators say.

However, officials still take seriously the claims by others who say they saw Mateen in the Pulse nightclub in the weeks — and even months — before the shooting.

Pulse did have a surveillance video system which likely captured the attack, a law enforcement official said, and the FBI has the video.

PHOTOS: Vigils Across Country Honor Victims of Pulse Massacre

Friday, a family member of Mateen's wife, Noor Zahi Salman, said Salman had no involvement in the attack and was "beaten and battered by this monster."

Another source close to Salman has said that Salman is cooperating with investigators and has volunteered to take a polygraph test.