Republican lawmakers slammed what they called a “pile of hot garbage” election security bill that passed in the Democrat-controlled House of Representatives Wednesday, saying that it violated free speech.

The proposed legislation would require campaigns to disclose illegal offers of campaign assistance from foreign governments and would restrict campaign-related communication between candidates and foreign governments. It would also require more transparency in political ads on social media such as Facebook and Twitter.

“Today Speaker [Nancy] Pelosi and House Democrats are voting to gut the First Amendment and silence free speech,” Nebraska Sen. Ben Sasse said. "This bill is [a] pile of hot garbage that would give federal bureaucrats the power to decide what is and isn’t political speech and then demand that records are kept on who says what."

"This bill is so blatantly un-American that it has managed to unite constitutional conservatives and ACLU [American Civil Liberties Union] liberals against it," he added.

The ACLU said in a statement that the bill “strikes the wrong balance, sweeping too broadly and encompassing more speech than necessary to achieve its legitimate goals” of preventing foreign interference in U.S. elections.

GOP LAWMAKERS STORM CLOSED-DOOR IMPEACHMENT SESSION, AS SCHIFF WALKS OUT

The bill passed along party lines with a vote of 227 to 181, with zero Republicans voting for it.

GOP leaders see the legislation as unnecessarily restrictive to campaigns. The White House threatened to strike down the bill ahead of the vote, saying it was redundant, broad and unenforceable. Senate Majority Leader Mitch McConnell said it would be dead on arrival in the Senate.

House Minority Leader Kevin McCarthy, R-Ca., said Republicans had already proposed a bill aimed at reducing foreign interference in U.S. elections last week. He said the House Democrats’ bill would not protect against foreign meddling and also “dangerously expands the federal government’s control over Americans’ free speech.”

OKLAHOMA JUDGE HALTS LAW REQUIRING DOCTORS TO INFORM PATIENTS THAT MEDICATION ABORTIONS CAN BE COUNTERACTED

“The vague wording of the legislation would potentially give Washington the unprecedented responsibility of determining what qualifies as 'legitimate' news or who can be deemed a 'legitimate' journalist,” McCarthy said.

“This partisan bill, which received zero Republican votes, will likely not see the light of day in the Senate, but it’s a reminder of the lengths Democrats will go to suppress competing speech,” he added.

The bill was introduced over the summer during the height of then-Special Counsel Robert Mueller's investigation into Russian interference in the 2016 presidential election. The probe established political connections between the Trump campaign and Russia, but it did not find a conspiracy between the two. The House's approval of the bill comes amid Democrats' impeachment inquiry into President Trump, who is accused of withholding military aid to Ukraine unless it investigated former Vice President and 2020 presidential hopeful Joe Biden, his son Hunter, and their business dealings in the country.

CLICK HERE TO GET THE FOX NEWS APP

The election security legislation is the third such bill that the Democrat-led House has passed relating to issues that arose from the 2016 presidential election.

In March, the House approved a bill aimed at making it easier for people to register to vote, tightening election security and requiring presidential candidates to disclose their tax returns. The Senate has yet to vote on the bill.

In June, the House approved a bill requiring paper ballots in federal elections and authorized $775 million to help states secure their election systems. However, Senate Republicans vetoed that and other election security legislation this week, and showed no signs of stopping their efforts to block Democrats' legislation.

Republicans said Wednesday’s bill amounted to a federal takeover of elections and could cost billions of dollars. McConnell declined to bring up a stand-alone bill on election security, but said he would support an effort to send $250 million in election security funds to states to bolster their election systems ahead of the 2020 election.

The Associated Press contributed to this report.