ST. LOUIS — An engineering student at Saint Louis University did too well on a class assignment to build a toy gun, creating a model so realistic that it prompted a campus-wide lockdown and hunt for a possible shooting suspect.

The private, Catholic university in Missouri warned all students to shelter in place for hours Wednesday afternoon and evacuated a residence hall after reports of a man with a gun on campus and shots fired.

Police and university officials eventually tracked the source of the scare to a toy gun. Students in the Aerospace and Mechanical “Engineering Manufacturing Procedures” class had been assigned to build a toy rubber band gun.

“At least one student created a very realistic toy gun and openly carried it into his residence hall,” the university said in a statement.

It is asking all of the students to bring the toy guns in closed containers to a university office Thursday, where they will be destroyed.

“This is the first time toy guns have been made in this class, and it will be the last,” the university said.

It is too early to say if anyone will be disciplined over the incident, university spokesman Jeff Fowler said.