Secretary of Homeland Security John Kelly took the blame for the poor rollout of President Donald Trump’s executive order banning nationals from seven majority-Muslim countries from entering the US, but said there was a need for speed in doing so.

Kelly testified before the House Homeland Security Committee on Tuesday, explaining the planning that went into the order and its implementation.

"The thinking was to get it out quick so that people trying to come here to harm us could not take advantage of a period of time to jump on an airplane," he said.

Kelly apologized for not briefing Congress beforehand, and said that the chaotic rollout was “all on me.”

“Going forward, I would have certainly taken some time to inform the Congress and certainly that’s something I’ll do in the future,” he said.

Members of the committee on both sides of the order decried how the order was implemented on the ground.

“The rollout of this executive order has been problematic. It has caused confusion here in Congress, across the country and around the world. It caused real problems” for lawful permanent residents, foreigners who aided the US military, and students at American schools who were in the air when the order was signed and became “trapped overseas,” Committee Chair Michael McCaul (R-Texas) said.

However, McCaul said he did agree with the executive order and applauded Kelly for “quickly correcting what I consider errors.”

It is "somewhat unfair" that Kelly was called in front of the committee to defend the order "that, by most accounts, he was required to implement with almost no notice," because the White House officials who directed the rollout, including senior aides Stephen K. Bannon and Stephen Miller, who should be the ones to "answer for this debacle," Representative Bennie Thompson (D-Mississippi), the committee’s ranking member, said.

The executive order, issued January 27, blocked the entry of people from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen from entering the US for 90 days. It also halted the US refugee program for 120 days.

The “temporary pause” was designed to allow the administration to review the vetting processes of the visa and refugee programs, Kelly said. Additional vetting steps may be added, and the ban may be extended for some of the affected countries, but there aren’t plans to add any more countries.

Some of the “enhanced” screening that the Trump administration “is thinking about” is to “increase its efforts to dig into” social media activity of visa applicants.

“If someone wants to come into our country,” Kelly said, “we want to say, for instance, what websites do you visit? Give us your passwords.”

If applicants refuse “then they don’t come,” he said. “If they truly want to come to America, they’ll cooperate. If not, next in line.”

Representative Sheila Jackson Lee (D-Texas) asked Kelly about the rationale for choosing those seven countries. No one from the listed countries has committed a terrorist attack in the US.

“We have evidence that citizens of those countries have done terrorist attacks in Europe,” Kelly replied.

The rollout of the executive order caused mass confusion, deportations and protests. There are at least 40 active lawsuits against the order in 17 states. On Friday, District Court Judge James Robart issued a nationwide, temporary restraining order against enforcing the executive order. On Tuesday, a three-judge panel for the 9th Circuit Court of Appeals heard arguments appealing that ruling.