A gunman opened fire in a Hungarian university classroom Thursday, killing one student and leaving three people seriously injured, the state-run news agency said.

Police detained a 23-year-old pharmacy student at the University of Pecs, MTI reported.

The suspect called police after fleeing to a nearby clinic following the shooting, Pecs police spokeswoman Bernadett Bojtor said, according to MTI. She said he used a handgun in the shooting, and was detained within 20 minutes.

University spokesman Zoltan Gyorffy said the shooting occurred during a class at the university's biophysics research institute, MTI reported.

One man was killed, and three people were injured including a cleaning woman and classmates of the suspect, police said. All three were in serious condition, with one suffering life-threatening injuries.

The city of Pecs is about 230 kilometers (145 miles) south of Budapest. Its university, one of the oldest in Europe, was founded in 1367.