WASHINGTON — U.S. Sen. Cory Booker joined most of his Senate Democratic colleagues in supporting President Barack Obama’s nuclear deal with Iran.

But he was in the minority when he added his name to legislation to ban U.S. companies from joining an international boycott of Israel.

In fact, Booker, D-N.J., is the only U.S. senator mentioned as a prospective 2020 Democratic presidential candidate to co-sponsor the bill. In all, just 14 of 49 Democrats (including U.S. Sen. Robert Menendez, D-N.J., who broke with his party and opposed the Iran deal) joined 42 of 51 Republicans in supporting the measure. A similar House bill is backed by 293 of 435 representatives, though not Rep. Beto O’Rourke, D-Texas, who also is mentioned in conversations about 2020.

The legislation is designed to oppose the Palestinian-led boycott, divestiture and sanctions movement, better known as BDS. While saying its actions are designed to “pressure Israel to comply with international law,” the group does not specifically support Israel’s right to exist and backs policies that would end its unique status as a country with a Jewish majority.

“We’ve seen the alarming rise in anti-Semitism in the United States and across the world in recent years manifest itself in many deeply concerning ways, including in the actions of foreign governments targeting Israel and the Israeli people,” Booker, D-N.J., said in announcing his support for the anti-BDS measure.

“I have long and staunchly opposed the BDS movement, and support this bill which will prevent international entities from imposing their will on U.S. businesses with regards to their decisions, consistent with U.S. law, to conduct commerce with our close ally Israel and its citizens."

Cardin sought unsuccessfully to add anti-BDS provisions to the spending bill covering the one-fourth of the federal government not funded through Sept. 30. That fell through when President Donald Trump refused to sign legislation without $5 billion in taxpayer funds for a southern border wall he promised Mexico would pay for, triggering a partial government shutdown that is continuing into the new year.

Booker’s decision to support the bill stands out in what is expected to be a crowded 2020 Democratic field, said Dr. Ben Chouake, president of NORPAC, the Englewood Cliffs-based political action committee that is the second-largest pro-Israel PAC in terms of campaign contributions.

“It helps, especially since he’s the only one who did it,” Chouake said.

Another potential 2020 candidate, U.S. Sen. Kirsten Gillibrand, D-N.Y., withdrew her support of the bill, and U.S. Sen. Bernie Sanders, I-Vt., came out against it, citing the actions of Israeli Prime Minister Benjamin Netanyahu.

"We remain resolved to our constitutional oath to defend the right of every American to express their views peacefully without fear of or actual punishment by the government,” Sanders and U.S. Sen. Dianne Feinstein, D-Calif., said in a joint statement. "At a time when the Netanyahu government is pursuing policies clearly aimed at foreclosing the two-state solution, it is deeply disappointing that Congress would consider choosing to penalize criticism of those policies.”

Their concerns mirrored those of the American Civil Liberties Union, which called the measure “a full-scale attack on Americans’ First Amendment freedoms.”

Federal courts in Arizona and Kansas have struck down anti-BDS laws in those states, the ACLU said.

Booker said changes made to the bill addressed those concerns, leading to his decision to support the measure.

“I feel confident that those modifications safeguard Americans’ constitutional right to free speech,” he said.

The pro-Israel community is a major source of campaign contributions to federal candidates, giving $18.2 million during the 2018 elections, just ahead of the airline industry with $17.1 million, according to the Center for Responsive Politics, a Washington-based research group.

NORPAC, which raises money for candidates in addition to making direct contributions, is Booker’s second-biggest lifetime source of campaign contributions, according to the center.

Chouake joined then-Gov. Chris Christie at an August 2015 press conference at Rutgers University in New Brunswick in an unsuccessful effort to get Booker to oppose the deal that relaxed economic sanctions on Iran in exchange for curbs on its nuclear program. Trump withdrew from the multinational agreement in May.

Despite Booker’s yes vote at the time, Chouake said all was forgiven.

“The reality is people are going to give the president of their own party a leap of faith when they’re specifically called and asked for it,” Choake said. “When he saw that his vote either way was not going to make a difference, he felt this was not one to fall on the sword for. He said, ‘I’m going to give the president a leap of faith.’ I trust his intentions."

Jonathan D. Salant may be reached at jsalant@njadvancemedia.com. Follow him on Twitter @JDSalant or on Facebook. Find NJ.com Politics on Facebook.