WASHINGTON (AP) — The House on Thursday backed election-year legislation that temporarily would halt the transfer of more detainees from the U.S. naval prison at Guantanamo Bay, Cuba.

The bill, which passed by a 244-174 vote, would bar the federal government from spending money on any Guantanamo prisoner transfers, even those to a foreign country. The ban would last until the end of the calendar year, or until a bill authorizing defense funding is signed into law.

The White House has threatened a veto, and the measure has no chance of becoming law. But the bill is an opportunity for Republicans to put Democrats on record on the issue in the weeks before the Nov. 8 election and use their votes against them in campaigns.

Within minutes of the vote, the House Republicans’ campaign committee sent out a news release with the headline, “Democrats vote to close GITMO and bring terrorists to U.S. soil (again).”

Republican backers said the transfers could allow some detainees to eventually return to terrorism and could threaten American communities when prisoners are transferred to prisons on U.S. soil.

Rep. Randy Forbes, R-Va., said that when these prisoners are held in a U.S. jail or prison, “you have just put a target on every school, every business, every mall in that community.”

The White House argues Guantanamo weakens national security by draining resources and emboldening violent extremists. About 60 prisoners are being held there, down from hundreds. The administration says transfers occur only after a rigorous review. The Pentagon is still weighing what maximum security facilities could handle the remaining detainees.

According to a report released Wednesday by the Office of the Director of National Intelligence, 122 of 693 detainees transferred out of the prison, or 17.6 percent, have returned to fighting. That’s four more than the 118 recorded as having re-engaged in militant activities, in a report issued in March.

The report said an additional 86 detainees are suspected of having returned to fighting.

House Speaker Paul Ryan, R-Wis., said the report underscored the need for the legislation.

Democrats said the legislation would strip Obama of his lawful authority over the prison.

“This bill is un-American and extreme,” said Rep. Jerrold Nadler of New York.