BELCHERTOWN — A University of Massachusetts Amherst student has been ordered to stay out of Hampshire County after being accused of threatening to cause harm at the university this week.

Geoffrey Small of Newbury pleaded not guilty Tuesday in Eastern Hampshire District Court to a charge of making a bomb/hijack threat with serious alarm.

Assistant District Attorney Andy Covington told Judge Thomas Estes that UMass Police on Monday became aware of an incident in which Small was overheard yelling at his phone that the university needed to be “shot up.”

Covington said campus police formed an “apprehension team” and arrested Small in his dormitory room without incident.

According to Covington, Small admitted to having an “outburst” when interviewed by police and told them he did not have any firearms. He told police he has been taking anabolic steroids, Covington said in court.

Small, who has no criminal record, has an expired firearms license and did not have any firearms when police searched his dorm room, according to Covington.

Small’s attorney, Michael Gillis, argued that based on evidence Covington presented, Small, a chemical engineering senior, had not committed a crime.

He said Small had not made a specific threat to a specific person, but rather was talking to himself when he made the alleged threatening statement.

“He flipped out at his phone,” Gillis said. “His choice of words was not good.”

The incident remains under investigation by UMass Police, according to Ed Blaguszewski, a university spokesman.

Police are investigating a report of a previous alleged threat, Blaguszewski wrote in an email, which university police first learned about Monday shortly before Small was arrested.

“The Dean of Students Office declined comment on the enrollment status of Mr. Small, since it is actively reviewing the matter,” Blaguszewski wrote.

At the beginning of the arraignment, Covington argued to have documents identifying witnesses placed under seal. Gillis argued to have all court documents impounded, saying he believed the case may be dismissed and that the file contained serious allegations.

Estes allowed the file to be sealed to the public pending a court hearing on the matter.

Small was released on conditions that he stay out of Hampshire County except for attending court dates, that he not consume drugs and submit to an anger management evaluation.

He is scheduled to appear in court again on Feb. 28.