It began in the morning, with a small crowd chanting and holding cardboard signs outside Kennedy International Airport, upset by the news that two Iraqi refugees had been detained inside because of President Trump’s executive order.

By the end of the day, the scattershot group had swelled to an enormous crowd.

They filled the sidewalks outside the terminal and packed three stories of a parking garage across the street, a mass of people driven by emotion to this far-flung corner of the city, singing, chanting and unfurling banners.

This was the most public expression of the intense reaction generated across the country by Mr. Trump’s polarizing decision. While those in some areas of the country were cheered by the executive order, the reaction was markedly different for many in New York. References to the Statue of Liberty and its famous inscription became a rallying cry.

Similar protests erupted at airports around the country.

Word of the protest at Kennedy first filtered out on social media from the immigrant-advocacy groups Make the Road New York and the New York Immigration Coalition. It seemed like it might stay small.