As officials search for more clues about the motive for an Egyptian immigrant’s shooting rampage that targeted law enforcement in Pennsylvania’s capital city, the U.S. Department of Homeland Security is calling it a "terror attack."

Pennsylvania State Police, Harrisburg police and other Pennsylvania authorities have yet to classify Ahmed Aminamin El-Mofty’s Friday afternoon shooting rampage as terror.

The 51-year-old shot at local and state police during the shooting spree that spread two miles across Harrisburg. Law enforcement officers shot and killed El-Mofty. Dauphin County District Attorney Ed Marsico said he has "no doubt" the gunman targeted law enforcement.

Tyler Q. Houlton, the acting press secretary for DHS, posted a statement on Twitter late Saturday confirming El-Mofty emigrated from his native Egypt on a "family-based immigrant visa" and became a naturalized citizen before going on the shooting spree that Houlton called a "terror attack."

Police positioned on corners around downtown Harrisburg. Capitol police, HBG city police, and PSP were seen responding. pic.twitter.com/xtJ2zAhxpy — Eric Heisler (@Heisler_Eric) December 22, 2017

BREAKING: My statement on Immigration Backgrounds of Recent Terror-Related Suspects: pic.twitter.com/I3JfZOfuBh — DHS spokesperson (@SpoxDHS) December 24, 2017

The gunfire began shortly after 4 p.m. Friday, when the man fired several shots at a state Capitol officer in downtown Harrisburg, striking his car several times and sending one shot "that went very close to hitting him," Marsico said. About 20 or 30 minutes later, he fired several shots at a state trooper, striking her once.

The trooper is "doing well," is in good condition and is expected to make a full recovery, Marsico said.

El-Mofty pursued the trooper to a residential neighborhood, where city and state police encountered him.

"He approached them with two handguns ... firing many shots at those police officers," and the officers returned fire, killing him, Marsico said.

Eric Heisler / Dauphin County District Attorney's Office

The "series of shootings" in the center of Pennsylvania's capital city had the entire city gripped with angst and confusion. Those feelings lingered into the evening when news that gunman was dead emerged.

El-Mofty was armed with two handguns, believed to be 9 mm weapons, authorities said.

Marsico said El-Mofty has ties to the Middle East and recently traveled there, but the motive for the attack isn't yet known.

A relative, Ahmed Soweilam, told PennLive.com that he and his family have no idea what to make of the reported actions by El-Mofty, his sister's ex-husband.

"That's not his behavior at all," said Soweilam, co-owner of a Halal store in Camp Hill. "That's not him. I still don't believe it."

Soweilam said the family had been estranged from El-Mofty, who had been married to his sister until they separated about six years ago. He said El-Mofty worked as a security guard and then moved back to Egypt, his former home, until returning a few months ago. He said El-Mofty had no history of violence or mental illness.

"He's not the perfect guy, but he's not an aggressive person," Soweilam said.

Family members and friends told NBC affiliate WGAL that they were unaware El-Mofty had even returned to central Pennsylvania.

"The long chain of migration that led to (El-Mofty's) admission into the United States was initiated years ago by a distant relative," Houlton said.

Houlton said incidents like the one involving El-Mofty "highlight the Trump administration's concerns with extended family chain migration." He said chain migration and the diversity visa lottery program have been exploited by extremists.

"Not only are the programs less effective at driving economic growth than merit-based immigration systems used by nearly all other countries, the programs make it more difficult to keep dangerous people out of the United States and to protect the safety of every American," he said.

Gov. Tom Wolf said Saturday he had talked to the director of Homeland Security as federal, state and local law enforcement authorities investigate the "attack on law enforcement."

In an earlier series of tweets, he thanked officers who "were directly in harm's way."

"They did not hesitate and protected others from harm," Wolf said.

Grateful for the swift reaction to this incident by Capitol Police, @PAStatePolice and City of Harrisburg Police. Our officers were directly in harm's way but they did not hesitate and protected others from harm. https://t.co/s6E4ZQGvTX — Governor Tom Wolf (@GovernorTomWolf) December 23, 2017

Marsico also expressed gratitude to state and local police for bringing a rapid end to an episode he said could have been much worse.

"This could have been a really tragic incidence with this individual firing many shots at police cars in downtown Harrisburg in the midst of rush hour traffic on a Friday afternoon and then coming up here in a residential neighborhood and firing again many shots," he said.

The district attorney's office asked anyone with information about El-Mofty to call 911 or submit a tip online.

The Associated Pres contirbuted to this report.