Dozens of students walked out of a class taught by Hillary Clinton in New York on Wednesday in protest at their university’s role in the “shaming” of pro-Palestinian demonstrators.

About 30 students were involved in the protest at Columbia University, where the former secretary of state and previous senator for the state was delivering a foreign policy lecture as part of her global affairs class.

The walkout was in support of students who signed a declaration blaming Israel for the 7 October Hamas attacks, and whose photographs were displayed on video screens on a truck parked near the university’s campus last week above the words “Columbia’s biggest antisemites”, the New York Times reported.

The photographs, according to the protestors, were lifted from a “secure and private” student portal at Columbia’s school of international and public affairs.

The Times reported that the walkout was planned and peaceful, with those leaving almost halfway through Clinton’s two-hour lecture, attended by about 300 students, joining several dozen other demonstrators in the lobby of the school.

They were demanding “immediate legal support for affected students” and “a commitment to student safety, well being and privacy”, according to the Times.

Clinton, and the school’s dean Keren Yarhi-Milo, who co-teaches the class, reportedly left by a side door and bypassed the protest following the lecture.

The Democratic former presidential candidate has taken a strong pro-Israel stance since the conflict erupted last month, last week denouncing those calling for a ceasefire as not understanding Hamas during a discussion at Rice University’s Baker Institute.

Columbia is among the universities that have become a flashpoint for protests over the war, with students on both sides angrily denouncing the other for the escalating violence and growing number of deaths.

A rally at the campus last month called by National Students for Justice in Palestine was part of a “day of resistance” at Israel’s military response to the attacks by Hamas, and also attracted a sizeable group of pro-Israel protestors.

The pro-Palestinian students whose faces were shown on screens near the campus last week had signed a declaration in support of Hamas. The statement said in part: “The weight of responsibility for the war and casualties undeniably lies with the Israeli extremist government”.

Officials at Columbia had no comment on the walkout, the Times reported. The newspaper noted that the university last week unveiled a new task force to counter student doxxing – the intentional publication online of a person’s private information, usually with malicious intent – and to enhance student safety.

Clinton, 76, Barack Obama’s first-term secretary of state from 2009-2013, began teaching her class, called Inside the Situation Room, at the start of the academic year in September. Some expressed frustration at the logistical impact of her presence, complaining that about 500 students in one of Columbia’s most popular computer science classes were evicted “to put up a nice stage for [Clinton’s] high-profile lecture series”.

Yarhi-Milo interrupted one of Clinton’s first lectures to allow students with cell phone cameras to take photographs of their celebrity teacher. “This is like the paparazzi,” Clinton said.

Announcing her appointment in February, then Columbia president Lee Bollinger said Clinton’s class would explore “fundamental questions” about how to advance the renewal of democracy and foster more engagement with women and youth across the US and the world.