A 17-year-old boy has become the fourth pupil to die from wounds suffered when a fellow student opened fire at a Michigan high school, authorities said.

The other dead included a 16-year-old boy who died in an officer’s patrol car on the way to hospital.

Seven people were wounded, some critically, including a 14-year-old girl who was placed on a ventilator after surgery.

School Shooting Michigan
Parents walk away with their children from a store car park after the shooting (Eric Seals/Detroit Free Press/AP)

Investigators are trying to determine a motive for the shooting on Tuesday at Oxford High School, in a community of about 22,000 people roughly 30 miles north of Detroit, Oakland County Sheriff Michael Bouchard said.

“The person that’s got the most insight and the motive is not talking,” he said at a news conference late on Tuesday.

Officers rushed to the school around lunch time as more than 100 calls flooded 911 dispatchers with reports of a shooting.

They arrested the student in a hallway within minutes of arriving. He put his hands in the air as officers approached, Mr Bouchard said.

The boy’s father on Friday bought the 9mm Sig Sauer used in the shooting, Mr Bouchard said. He did not know why the man bought the semi-automatic handgun, which his son had been posting pictures of and practising shooting, the sheriff added.

Authorities have not released the boy’s name.

School Shooting-Michigan
The scene in Michigan (AP)

The four students who were killed were 16-year-old Tate Myre, 14-year-old Hana St Juliana, 17-year-old Madisyn Baldwin and Justin Shilling, who died on Wednesday.

Mr Bouchard said Tate died in a patrol car as an officer tried to get him to an emergency room.

A teacher who received a graze wound to the shoulder has left hospital, but seven students ranging in age from 14 to 17 remained in hospital through the night with gunshot wounds, he said.

The gun had seven more rounds of ammo in it when he surrendered, Mr Bouchard said.

Undersheriff Mike McCabe said the student’s parents had advised their son not to talk to investigators. Police must seek permission from a juvenile’s parents or guardian to speak with them, he added.

Oakland County prosecutor Karen McDonald said her office expects to issue charges quickly.

School Shooting Michigan
Students attend a vigil at LakePoint Community Church in Oxford (Paul Sancya/AP)

Authorities were made aware of posts on social media that said there had been threats of a shooting at the roughly 1,700-student school, but Mr Bouchard said they did not know about the rumours until after the attack.

Mr McCabe downplayed the significance of a situation in early November when a deer’s head was thrown off the school roof, which he said was “absolutely unrelated” to the shooting.

The vandalism prompted school administrators to post two letters to parents on the school’s website, saying they were responding to rumours of a threat against the school but had found none.

Mr Bouchard said the student in custody had had no previous run-ins with his department and he was not aware of any disciplinary history at school.

“That’s part of our investigation to determine what happened prior to this event and if some signs were missed how were they missed and why,” he said.

The campus was placed on lockdown during the attack, with some children sheltering in locked classrooms. They were later taken to a nearby grocery store to be picked up by their parents.

The district said in a statement that all of its schools would be closed for the rest of the week.

Isabel Flores, a 15-year-old ninth grader, told WJBK-TV that she and other students heard gunshots and saw another student bleeding from the face. They then ran from the area through the rear of the school, she said.

Authorities said they were searching the suspect’s mobile phone, school video footage and social media posts for any evidence of a possible motive.