ANALYSIS: Trump's Order Heightens Risk of Extremist Attacks in the US, Counterterror Expert Says John Cohen is a former counterterrorism coordinator for U.S. Homeland Security.

 -- President Trump said his executive order restricting entry into the U.S. of people from seven Muslim-dominated countries is to keep Americans safer, but one former Homeland Security official who is an ABC News contributor said the move could instead do the opposite by inspiring violent extremist attacks in the U.S.

"The White House has indicated that this action is necessary to address serious terror threats facing the nation, but today the most significant threat facing our country involves individuals living in the U.S. carrying out terror attacks independent of any group and inspired by what they see on the internet," said John D. Cohen, who was counterterrorism coordinator and acting undersecretary for intelligence at the Department of Homeland Security under President Barack Obama from 2009 to 2014 and before that served in the Office of the Director of National Intelligence under President George W. Bush.

"They're distracting from their own goals," Cohen said of the Trump administration's aims to improve national security.

The order signed Friday immediately suspends immigration from seven predominantly Muslim countries in the Middle East and Africa — Syria, Yemen, Sudan, Somalia, Iraq, Iran and Libya — for 90 days. It ends for 120 days the entry of any refugees into the U.S. and indefinitely suspends the entry of Syrian refugees.

Cohen suggested that a terrorist group like ISIS may exploit the order as a recruitment tactic. Also, Trump's action could inspire individuals already in the U.S. to launch a violent attack, he said.

Cohen added that in many respects, the "extreme vetting" called for in the executive order already exists through the government's data collection and vetting capabilities used on individuals considered possible threats — a capability that has been improved dramatically over the past six years. This vetting could, however, be far more effective if the process were more automated, he said.

With the executive order, the government seems "to restrict travel of people who have done nothing wrong," and such an action puts the Trump administration at risk of losing the trust of the American people, Cohen said.

"You only survive in this business by having credibility," he said.

But the president and other White House officials on Sunday defended the executive order as a vital step in securing the country.

"America is a proud nation of immigrants, and we will continue to show compassion to those fleeing oppression, but we will do so while protecting our own citizens and border," Trump said in a statement. "This is not about religion — this is about terror and keeping our country safe. There are over 40 different countries worldwide that are majority Muslim that are not affected by this order. We will again be issuing visas to all countries once we are sure we have reviewed and implemented the most secure policies over the next 90 days."

White House press secretary Sean Spicer told ABC News' Martha Raddatz on "This Week" on Sunday that the order was established to make sure people entering the country have peaceful intentions.

"The safety of the American citizens, the safety of our country has got to be paramount. That's what the president did yesterday, is to ensure that the people that we're letting into our country are coming here with peaceful purposes and not to do us harm," Spicer said.

Spicer also said it's possible that Trump will expand the list of countries named in the order.