President Donald Trump said on Thursday his administration planned to require immigrants seeking asylum in the United States to come into the country through a legal port of entry, pushing a hard line on immigration ahead of elections next week.

The president’s remarks, five days before U.S. voters determine which party will control Congress and state governorships across the country, drew immediate criticism as an effort to generate fear and energize his political base.

“Migrants seeking asylum will have to present themselves lawfully at a port of entry,” Trump told reporters at the White House, painting a caravan of migrants traveling from Central America toward the United States as a dangerous threat.

“Those who choose to break our laws and enter illegally will no longer be able to use meritless claims to gain automatic admission into our country,” he said.

It was not clear whether the plan would pass legal muster, although Trump, who sought to use immigration as an issue to motivate Republican voters in the 2016 presidential race and now ahead of the Nov. 6 elections, said it would. He added that an executive order was in the process of being finalized, but provided few details.

Federal law provides that any immigrant in the United States may apply for asylum, regardless of whether he or she enters the country through a designated port of entry.

Trump has ramped up his tough stance on illegal immigration in recent days. He deemed the group of migrants from Central America a threat to Americans. It is made up of people who have left poverty and violence at home and are heading slowly through Mexico toward the U.S. border. Trump referred to the movement as an “invasion.”

Mexico on Wednesday put the size of the caravan that left Honduras in mid-October at 2,800 to 3,000 people. Other caravans have since followed.

The president, who has ordered U.S. troops to the border with Mexico, also suggested rock-throwing by migrants would be treated as equivalent to gun usage.

“They want to throw rocks at our military, our military fights back. We’re going to consider, and I told them to consider it a rifle. When they throw rocks like they did at the Mexico military police, I say: Consider it a rifle,” Trump said.