A gunman killed a teacher, a local woman and her daughter after opening fire in a classroom at a university hospital campus in Rotterdam and a nearby house, Dutch police said.

The 32-year-old suspect, a university student, fatally shot the 39-year-old woman, who lived in his neighbourhood, along with her 14-year-old daughter.

After setting the woman's house on fire, the gunman went to the Rotterdam Medical Centre university hospital.

There, he entered a classroom and fatally shot a 43-year-old teacher.

The man was arrested near the hospital, where he also set a fire. His motive was unknown.

"We have been shocked by a horrible incident. Shots were fired in two different places in the city. Many people witnessed it," Rotterdam Mayor Ahmed Aboutaleb said.

"Emotions in the city are very high. My condolences go out to the victims."

Police at the scene of the shooting at Erasmus University

"This is a very dark day," Netherlands' caretaker Minister of Justice and Security Dilan Yesilgöz was quoted by newspaper De Telegraaf as saying in comments made in Brussels.

"The suspect was known to law enforcement and in 2021 he was prosecuted and convicted for animal abuse," said Hugo Hillenaar, Rotterdam's chief prosecutor.

The 32-year-old suspect was arrested near the hospital

Videos posted online showed police instructing students, some wearing medical gowns, to run outside as heavily armed arrest teams arrived at the scene.

One video showed a man in handcuffs wearing what appeared to be camouflage trousers.

Police said there were no indications of a second attacker.