Better safe than sorry…

The University of Chicago canceled all classes and activities on its main campus Monday because of a specific anonymous threat of gun violence, the university said in a statement Sunday night.

Robert Zimmer, the university president, said that F.B.I. counterterrorism officials had contacted the university on Sunday to warn that “an unknown individual” had posted a message online that threatened an armed attack on the main campus quad at 10 a.m. Monday.

Mr. Zimmer said he decided to cancel classes “based on the F.B.I.’s assessment of this threat and recent tragic events at other campuses across the country.” He added that the decision had been made “in consultation with federal and local law enforcement officials.”

Students, nonmedical faculty and the university’s nonessential staff members were urged to stay away from the main campus in the Hyde Park neighborhood of Chicago on Monday. Students who live in university housing were told to remain in their dormitories.

The university canceled events at a number of other facilities on Monday, as well, including the University of Chicago Laboratory Schools, the University of Chicago Charter School campuses and the university’s libraries.