A former Fairfield University student claiming to have a bomb took a religious studies class hostage Tuesday afternoon, but released an associate professor and 22 student hostages by late evening and was taken into custody around 11 p.m.

The suspect, identified only as a recent graduate, remained in the Canisius Hall classroom for about an hour after he released the last hostage, Fairfield First Selectman Kenneth Flatto said.

Flatto said the package the student claimed was an explosive device was left in the classroom and was being examined by a bomb squad.

The suspect released five of the hostages — all female — shortly after taking over the classroom around 4 p.m. He freed seven more people over the next few hours.

Four more student hostages were released around 8 p.m., and professor Elizabeth A. Dreyer and five more students were released around 9 p.m.

The last hostage, who authorities said was acquainted with the suspect, was released around 10 p.m.

Dreyer’s husband, John Bennett, said his wife told him she was OK.

“She says the man is clearly disturbed, and she said she wants to see me,” he said.

The hostages were taken to a safe location to receive counseling and be debriefed, police said.

Flatto had said earlier that the suspect made some demands, but said he could not provide any details or comment on a possible motive.

WCBS-TV in New York said the suspect ordered one of the hostages to call the station, demanding that a statement be read over the air. The statement, which station spokeswoman Karen Mateo described as “rambling and anti-Semitic,” was not broadcast.

Evening classes were canceled and students were holding a prayer service in one of the residence halls, student Joni Saunders said.

Fairfield is in southwestern Connecticut, about 20 miles from the New York state border. The school has about 5,000 undergraduate and graduate students.

Canisius Hall is home to the academic vice president, the College of Arts and Sciences, the university registrar, and other offices as well as faculty offices and classrooms.

–Associated Press