It was the first day back in class following the holiday break at Perry High School, about 40 miles northwest of state capital Des Moines.

Officials named the 17-year-old suspect as Dylan Butler, and said he was found dead by responding officers from an apparent self-inflicted gunshot wound.

An official with Iowa's Department of Criminal Investigation told reporters police also discovered an improvised explosive device when searching the high school. Members of the state fire marshal's office and the federal Bureau of Alcohol, Tobacco, Firearms and Explosives rendered the device safe.

The official said Butler was armed with a pump-action shotgun and a handgun, and made a number of social media posts around the time of the shooting. The motive for the attack is under investigation.

The official also said four of the wounded victims are students, and the fifth is a school administrator.

Iowa is currently the focus of intense political attention: the state will hold the first nominating contest in the Republican primary in 11 days.

Republican presidential candidate Vivek Ramaswamy had been scheduled to hold a rally in Perry. A campaign spokesperson said the event had been changed to a prayer gathering after reports of the shooting.