JERUSALEM — The Israeli Parliament on Monday passed contentious legislation that effectively bans any public call for a boycott against the state of Israel or its West Bank settlements, making such action a punishable offense.

Critics and civil rights groups denounced the new law as antidemocratic and a flagrant assault on the freedom of expression and protest. The law’s defenders said it was a necessary tool in Israel’s fight against what they called its global delegitimization.

Passage of the law followed a string of efforts in the rightist-dominated Parliament to promote legislation that is seen by the more liberal Israelis as an erosion of democratic values.

Some critics argued passage of the legislation against boycotts would further delegitimize Israel, which is facing increasing pressure over West Bank settlements that Palestinians regard as part of the territory for a future state. Continued construction in the settlements has been a major impediment in attempts to resume stalled peace talks.