DULUTH, Minn. — Shortly after caving to political pressure and signing an executive order that ends the separation of families by detaining parents and children together at the border, President Trump vowed at a rally here on Wednesday that his administration would be “just as tough” on immigration as before.

The president was here in part to support Pete Stauber, a Republican candidate for a House seat. But, as he usually does on the campaign trail, Mr. Trump focused more on his agenda — and his enemies, at one point declaring that he had “a much better apartment” than his critics.

Turning to immigration, Mr. Trump castigated the Democrats.

“The Democrats want open borders: ‘Let everybody pour in, we don’t care,’” he said, as the crowd erupted into a chant of “Build the Wall,” and mocked a handful of people who tried to protest his policy. (“Go home to your mom,” the president told at least one demonstrator.)