Police Commissioner Jari Kinnunen of the Tampere Police told Yle News late Friday the teacher had acted correctly by preventing the man from entering the classroom.
At a press conference in the nearby city of Tampere, authorities said they took him into custody without the use of force. They believe the suspect, a local man born in 1989, used two weapons in the attacks in two locations.
He is to be charged with attempted murder and endangering public safety.
Shortly after 9.30am, the local emergency centre received a call saying that a man had been shot in the hand at an office in Orivesi. News of the incident at the school came shortly afterwards. The school had received a warning that the gunman might be on his way there.
Several shotgun blasts were fired through a classroom door at the Orivesi Comprehensive School. There were 14 pupils and a teacher in the room at the time. No-one was hurt at the school.
The man marched into a classroom during a maths lesson but was pushed out of the room back into the corridor by a teacher who then locked the door and rang the emergency number. A second teacher then saw the suspect fire shots in the door and wall while pupils crouched in a corner.
Motive: broken relationship?
According to the police, the man's former girlfriend was in the classroom at the time of the shooting.
Kinnunen told Yle Tampere on Friday evening the suspect had earlier shot at the girl's father, injuring him in the hand. Kinnunen added the man had been unable to accept that the relationship with the girl had come to an end. Prior to entering the school, the man also tried to visit the girl's home.
The family had sought a restraining order against the man. He was to have attended a hearing on the restraining order next Wednesday.
Earlier this month, the man and a local girl in her mid-teens had been reported missing for nearly a week before they were found in Posio, Finnish Lapland.
3 legal hunting weapons
Kinnunen said the suspect had no criminal record. He had licenses for three guns: a shotgun, a rifle and a small-bore rifle. The permits were granted for hunting.
Speaking to Yle News, Kinnunen said the teacher had acted correctly by removing the gunman from the classroom.
The school's headmaster, Timo Hakulinen, said both teachers and pupils had acted in accordance with safety instructions. He praised the bravery shown by the teacher in removing the man from the classroom.
Police seized the shooter in the schoolyard soon after the shots were fired.
"After the police patrol arrived at the school, the man came out of the school with a gun. They convinced him to abandon the weapon," explained Kinnunen.
Pupils were offered crisis counselling at a nearby sports gym.
Special services were held at Orivesi's Lutheran Church on Friday afternoon and evening.
PM: No need for tougher gun laws
On Saturday, Prime Minister Jyrki Katainen said that there is no need to tighten gun laws in the light of Friday's shootings in the south-central town of Orivesi.
He said that this would be an overly-facile response to such a difficult issue.
Katainen said that society should somehow succeed better at finding and helping people in emotional distress.