WASHINGTON — The secretary of homeland security, John F. Kelly, acknowledged to lawmakers on Tuesday that President Trump’s travel ban from seven Muslim-majority countries had been rushed and would have benefited from better coordination.

But Mr. Kelly defended the ban, saying he expected the administration to win a court challenge.

“I should have delayed it just a bit so that I could talk to members of Congress, particularly to the leadership of committees like this, to prepare them for what was coming,” Mr. Kelly told the House Committee on Homeland Security.

He supported, however, Mr. Trump’s contention that it was not a Muslim ban and defended the order as “lawful and constitutional” and said the review ordered by the president was “necessary and appropriate.”

As the United States Court of Appeals for the Ninth Circuit, in San Francisco, prepared to hear arguments on Tuesday over whether to lift a stay on enforcement of the ban, immigration lawyers and refugee groups continued to try to take advantage of the window provided by a federal judge in Seattle to bring refugees into the country.

“While some of the core tenets of this order are the subject of ongoing litigation, it is my belief that we will prevail and be able to take the steps necessary to protect our nation,” Mr. Kelly said. “Americans must feel safe to walk down the street, go to the mall or to a nightclub anywhere and anytime. Fear must not become the status quo as it has in so many parts of the world.”