WASHINGTON (Reuters) - President Donald Trump on Friday backtracked from his suggestion a day earlier that American troops sent to the U.S. border with Mexico would be free to fire on migrants who throw rocks at them, saying that rock-throwers would only be arrested.

“They won’t have to fire. What I don’t want is I don’t want these people throwing rocks,” Trump told reporters outside the White House. “If they do that with us, they’re going to be arrested for a long time.”

Trump’s rhetoric on shooting migrants drew criticism from human rights groups that said he was stoking fear ahead of next week’s congressional elections. Calling migrants a national security threat “is as absurd as it is cruel,” advocacy group Human Rights First said in a statement.

In his comments, Trump suggested the military could fire on migrants who cross the border illegally if they throw rocks at troops.

“They want to throw rocks at our military, our military fights back. ... 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.

The Nigerian army on Friday used Trump’s remarks to justify opening fire at Shi’ite Muslim protesters earlier in the week. Authorities have reported only a few killed but a Shi’ite group said the toll was more than 40.

After Trump’s remarks on Thursday saying stone-throwers should be treated as if they were carrying rifles, the Nigerian Army posted a note on Twitter with a video of Trump’s remarks, adding: “Please Watch and Make your Deductions.”

The U.S. president has hardened his stance on immigration in a bid to rouse his political base ahead of the elections. His Republican party is in an uphill fight to maintain control of the House of Representatives on Tuesday, although it is expected to pick up seats in the Senate.

The Pentagon said on Monday it was deploying more than 5,200 troops to the border at Trump’s direction to confront a caravan of men, women and children traveling through Mexico as they flee violence and poverty in Central America. Trump has characterized it as an “invasion” of migrants.

Mexico has said 2,800 to 3,000 people are in the caravan, which left Honduras in mid-October, although many are expected to drop off before reaching the U.S. border.

Trump also said on Thursday his administration was finalizing a plan to block immigrants who do not come into the United States at a legal port of entry from applying for asylum, although federal law allows any immigrant in the United States to do so.

Still, migrant caravans have pressed on. On Friday, a smaller caravan from El Salvador crossed through a river to enter the Mexico’s southern state of Chiapas.