NEW DELHI — Dozens of masked men in New Delhi stormed one of India’s most prestigious universities on Sunday, attacking students and professors with rods and bricks, vandalizing dormitories and injuring at least 42 people, some of them seriously, officials said.

Some students accused the police of complicity, and videos posted on social media appeared to show officers standing by as students were beaten in front of them.

The attack, which was described by students and witnesses and recorded in videos posted on social media, happened at Jawaharlal Nehru University, a leafy campus in New Delhi. Students at the university said the attackers belonged to the Akhil Bharatiya Vidyarthi Parishad, a Hindu nationalist student organization. The group denied involvement.

Witnesses said the attackers rushed the campus between 7 p.m. and 8 p.m. They shattered windows, attacked medics and yelled, “Hail Lord Ram!” — a reference to a Hindu god that has become a battle cry for far-right Hindu nationalists as India has grown more polarized under Prime Minister Narendra Modi.