Mayor Michael R. Bloomberg on Tuesday defended the New York Police Department’s monitoring of the Web sites of Muslim student groups at more than a dozen universities across the Northeast, framing the effort as one way to guard against the threat of terrorism.

“The Police Department goes where there are allegations, and they look to see whether those allegations are true,” Mr. Bloomberg said at an appearance at the Brooklyn Public Library. “That’s what you would expect them to do. That’s what you would want them to.”

The mayor’s support of the department’s intelligence-gathering came as officials at several universities expressed deep concern over what they called a manner of police activity that they had been in the dark about for years.

Yale University’s president, Richard C. Levin, said in an e-mail on Sunday to students and faculty and staff members, “I am writing to state, in the strongest possible terms, that police surveillance based on religion, nationality or peacefully expressed political opinion is antithetical to the values of Yale, the academic community and the United States.”