A student shot six people, one of them fatally, at a high school in the US state of Iowa before taking his own life on the first day back from holiday break, police said.
A "pretty rudimentary" improvised explosive device was found by investigators at Perry High School, police said, and rendered safe.
Five of those shot were students and one is a school administrator.
The student that died was in sixth-grade, which is for 11 or 12-year-olds.
Reports of an active shooter came in at 07:37 local time (13:37 GMT) and the first officer reached the scene within minutes, police said.
Speaking to reporters after the shooting, Iowa Division of Criminal Investigation Assistant Director Mitch Mortvedt said that officers responding to the scene quickly found what they determined to be the suspect with a self-inflicted gunshot wound.
The suspect was later identified as Dylan Butler, a 17-year-old student. He was armed with a pump-action shotgun and a small calibre-handgun, according to police.
Mr Mortvedt also said that the suspect had "made a number of social media posts in and around the time of the shooting."
Of the injured, one was in a critical condition and four were stable, Mr Mortvedt added.
Earlier in the day, Dallas County Sheriff Adam Infante told reporters that owing to the early hour, "luckily, there was very few students and faculty in the building, which I think contributed to a good outcome in that sense."
Lori Meinecke, a Perry High School teacher, told a local radio station that she heard about six to seven gunshots around that time.
The middle school was cleared at about 08:25 local time and the high school was cleared at 08:27 local time. The two schools are on the same campus.
A local TV station spoke to Kevin Shelley, a parent of a 15-year-old, who said his son had been shot in the hallway, but would survive.
Mr Shelley's son told him he was hit in the back and had his arm grazed before running into a classroom to seek shelter with fellow students.
Agents from the Federal Bureau of Investigation (FBI) and the Bureau of Alcohol, Tobacco, Firearms and Explosives (ATF) responded. The Iowa Department of Criminal Investigation was leading the investigation.
"It is horrendously awful," said Linda Andorf, board president for the Perry Community School District, NBC reported. "This is just disgusting. It's terrible."
"It's impossible to understand why anything like this happens," Iowa Governor Kim Reynolds said at a news conference, adding that "every Iowan stands" with the victims and their families.
US President Joe Biden was briefed on the shooting and was in touch with Governor Reynold's office, according to the White House.
The town of Perry has less than 10,000 residents and is about 40 miles (64km) north-west of Iowa's capital, Des Moines.
The shooting comes days before the Iowa caucuses begin on 15 January, kicking off the 2024 Republican primary process.
The shooting came as one of the candidates, Republican Vivek Ramaswamy, was scheduled to campaign in Perry. The event was cancelled and replaced by a prayer and discussion between Mr Ramaswamy and local residents.