The Saudi officer legally bought the gun he used to kill three sailors at Naval Air Station Pensacola in Florida, according to two law enforcement sources.
One source said Mohammed Alshamrani purchased the weapon from a gun store earlier this year.
He obtained a hunting license, which allows a non-immigrant on a non-immigrant visa to purchase a gun, the source said.
Meanwhile, investigators have been trying to determine what motivated Alshamrani to open fire in a classroom building on Friday. He used a handgun and was killed after two deputies exchanged gunfire with him.
The FBI identified Alshamrani as the shooter. He was a 21-year-old second lieutenant in the Saudi Arabian air force and a student naval flight officer, according to an FBI spokesperson.
It does not appear he had ties to terrorist groups, two sources told CNN.
Escambia County Sheriff David Morgan told CNN's Erin Burnett that the FBI had secured the areas on base where the shooter was staying and they had recovered his laptop and cell phone.
A senior administration official told CNN that investigators found some concerning statements and online materials but noted that it was still early in the investigation.
National Security Adviser Robert O'Brien said Sunday on CBS' "Face The Nation" that the assault "appears to be a terrorist attack" but authorities will have to "wait to see what the FBI investigation shows."
Motive still under investigation
Just minutes before authorities were first alerted to the deadly shooting, a Twitter account aligning with Alshamrani's name posted a message that raises the possibility the attack was inspired by al Qaeda and its founder, Osama bin Laden, CNN's Nic Robertson and Paul Cruickshank said.
The first call alerting law enforcement of an incident at the Florida base came about 6:51 a.m., according to the Escambia County Sheriff's Office.
Twelve minutes before, at 6:39 a.m., a Twitter account with the handle @M7MD_SHAMRANI posted a message addressed to the American people, declaring hate for Americans because of their "crimes" against Muslims.
CNN has been unable to verify the source of the tweet, which was previously reported on by SITE Intelligence Group. Law enforcement has not commented on it.
When asked about the account, Twitter spokeswoman Aly Pavela confirmed the account was suspended and said, "That's all we have to share."
The message, addressed to the American people, repurposed words used by bin Laden and the American al Qaeda terrorist cleric Anwar al-Awlaki.
When asked about the gunman's motive on Saturday, US Defense Secretary Mark Esper stressed the investigation was ongoing.
"I can't say it's terrorism at this time. I think we need to let the investigators of the FBI do its work," he said.
The FBI office in Jacksonville said it was not "not aware of any credible threat toward the Pensacola community."
Before Friday's attack, Alshamrani watched mass shooting videos at a dinner party, The New York Times reported, citing a source with knowledge of the investigation but not authorized to speak publicly.
Alshamrani and a small group of Saudi nationals had just traveled to New York City over the Thanksgiving holiday, a law enforcement source told CNN.
They visited several museums and the Rockefeller Center, where the Christmas tree lighting was taking place. Authorities don't know why they traveled to the city, the source said.
The Saudis who accompanied Alshamrani are currently being interviewed by law enforcement and are being cooperative, the source added.
Earlier on Saturday, a US official told CNN that a number of Saudi nationals have been detained for questioning in connection with the shooting. The US official did not provide information about the connection between the shooter and the Saudis or the status of those who were detained.
President Donald Trump has said it is not known whether one person or a "number of people" were responsible for the attack.
"We will get to the bottom" of what happened, he said Saturday.
Alshamrani had been training at the Florida base for two years, a spokesperson for the assistant to the secretary of defense said.
Foreign students from "partner nations" have trained at the base to learn naval aviation for years, Commanding Officer of NAS Pensacola Capt. Tim Kinsella told reporters.
Three US Navy sailors were killed when they "didn't run from danger" after the gunman opened fire at the base, US Navy officials said.
The sailors were Airman Mohammed Sameh Haitham, 19, of St. Petersburg, Florida; Airman Apprentice Cameron Scott Walters, 21, of Richmond Hill, Georgia; and Ensign Joshua Kaleb Watson, 23, from Coffee County, Alabama.
Watson had been training to become a military jet pilot when he died Friday after the gunman opened fire at a classroom building inside the base, his family said.
"My youngest brother gave his life for his country in a senseless shooting," his brother, Adam Watson, wrote in a Facebook post. "We are beyond proud, but there is a hole in our hearts that can never be filled."
Watson was a senior at the US Naval Academy last spring and was a four-year member of the school's NCAA rifle team.
Sameh Haitham, the father of Airman Mohammed Sameh Haitham, told CNN his son "was an exceptional kid."
The 19-year-old was an "all-star athlete" who took part in running and basketball before joining the Navy.
Several others were wounded, including two sheriff's deputies and a Navy police officer, Escambia County Chief Deputy Chip Simmons said at a prayer vigil in Pensacola Saturday.
One deputy, who was shot in the arm, was treated and released on Friday. The other deputy had surgery on Friday and is expected to recover, Simmons said.
The Navy officer is "going to be fine," Simmons added.
Details about the others who were wounded were not available.
Friday's attack was the second shooting at a military base in three days. Last week, active duty US sailor Seaman Gabriel Romero killed two civilian employees and injured another before killing himself at Pearl Harbor Naval Shipyard in Hawaii. Investigators have not announced a motive for that shooting.