SYRACUSE, N.Y. — A former Cornell University student accused of posting violently threatening statements against Jewish people on campus shortly after the start of the war in Gaza in the fall pleaded guilty in federal court Wednesday.

Patrick Dai, from the Rochester, New York, suburb of Pittsford, was accused by federal investigators of posting anonymous threats to shoot and stab Jewish people on a Greek life forum in late October. Dai, a junior, was taken into custody Oct. 31 and was suspended from the Ivy League school in upstate New York.

The threats came amid a spike of antisemitic and anti-Muslim rhetoric related to the war and unnerved Jewish students on the Ithaca campus. Gov. Kathy Hocul and Doug Emhoff, the husband of Vice President Kamala Harris, traveled separately to Ithaca in the wake of the threats to support students. Cornell canceled classes for a day.

Dai pleaded guilty to posting threats to kill or injure another person using interstate communications. He faces a maximum sentence of five years in prison on Aug. 12, according to the U.S. attorney's office for northern New York.

''This defendant is being held accountable for vile, abhorrent, antisemitic threats of violence levied against members of the Cornell University Jewish community,'' Assistant Attorney General Kristen Clarke of the Justice Department's Civil Rights Division said in a prepared release.

One post from October included threats to stab and slit the throats of Jewish males and to bring a rifle to campus and shoot Jews. Another post was titled ''gonna shoot up 104 west,'' a university dining hall that caters to kosher diets and is located next to the Cornell Jewish Center, according to a criminal complaint.

Authorities tracked the threats to Dai through an IP address.

Dai's mother, Bing Liu, told The Associated Press in a phone interview in November she believed the threats were partly triggered by medication he was taking to treat depression and anxiety. She said her son posted an apology calling the threats ''shameful.''

Liu said she had been taking her son home for weekends because of his depression and that he was home the weekend the threats went online. Dai had earlier taken three semesters off, she said.