The U.S. Senate on Wednesday overwhelmingly approved legislation amending Section 230 of the Communications Decency Act to allow civil and criminal sex trafficking-related claims against internet companies, sending the bill to the White House.

The Allow States and Victims to Fight Online Sex Trafficking Act, or FOSTA (H.R. 1865), was approved in a vote of 97-2. The only lawmakers voting against the bill were Oregon Democrat Ron Wyden, who co-authored Section 230, and Kentucky Republican Rand Paul. Sen. John McCain, R-Arizona, did not vote, although he supported the bill.

A proposed amendment by Wyden to help fund sex-trafficking enforcement was defeated. Wyden withdrew a separate proposed amendment that aimed to expressly shield internet companies from legal liability, if they actively moderated their forums.

President Donald Trump is expected to sign the bill into law. After the House approved H.R. 1865 at the end of February, White House Press Secretary Sarah Sanders called the legislation “an important step forward” in the fight against sex trafficking.

Critics of the bill, however, have said the legislation is vaguely worded and will not only be counterproductive—by forcing sex-trafficking operations further underground—but also hinder internet freedom by exposing companies to litigation over user content.

The Electronic Frontier Foundation said in a statement that, in the wake of the bill's passage, “online platforms will have little choice but to become much more restrictive in what sorts of discussion—and what sorts of users—they allow, censoring innocent people in the process.”

The bill expands existing criminal sex-trafficking law to rope in facilitation of trafficking by web sites. It also makes those provisions retroactive, which the Justice Department has said is probably unconstitutional.

Earlier drafts of the legislation were strongly opposed by the Internet Association, which represents companies including Google, Facebook, Twitter and Reddit. But the organization changed its position after tweaks were made.

In a tweet, Wyden took a shot at internet companies for not taking a stand against the bill. “We are in a fight for the Internet every day. Big Internet companies are NOT engaged in this fight – Their only interest is currying favor with the nations where they wish to do business,” he wrote.

The impetus for the legislation was Backpage.com, the online classified ad site that a Senate investigation found had “knowingly concealed” evidence of criminal sex trafficking through its site and facilitated child sex trafficking.

That investigation was led by Sens. Rob Portman, R-Ohio, and Claire McCaskill, D-Missouri, who championed the FOSTA bill and its earlier Senate version, called SESTA.

“Today's vote is a victory for trafficking survivors and a victory for our efforts to help stop the selling of women and children online,” Portman said in a statement, adding that the legislation “will ensure justice for trafficking victims and help us combat this evil crime.”