A man who wounded three people before storming into the central Kansas factory where he worked and shooting 15 others, killing three of them, had just been served a protection from abuse order that likely triggered the attack, a sheriff said Friday.

The attack Thursday evening at the Excel Industries lawnmower parts plant in Hesston ended when a police officer killed the attacker during a shootout, Harvey County Sheriff T. Walton said. He described the officer Friday as a "tremendous hero" because there were still 200 or 300 other people in the factory and that the "shooter wasn't done by any means."

"Had that Hesston officer not done what he did, this would be a whole lot more tragic," Walton said.

The sheriff identified the gunman as Cedric Ford, a 38-year-old plant worker who had several convictions in Florida over the last decade, including for burglary, grand theft, fleeing from an officer, aggravated fleeing, carrying a concealed weapon, all from Broward and Miami-Dade counties.

Online records show Ford was released from the custody of the Florida Department of Corrections in February 2007. It was unclear from the public records whether he had completed probation.

According to the Wichita Eagle, Ford has also had criminal cases in Harvey County, including a misdemeanour conviction in a 2008 fighting or brawling case and various traffic violations from 2014 and 2015.

The shooting came less than a week after authorities say a man opened fire at several locations in the Kalamazoo, Mich., area, leaving six people dead and two severely wounded. Authorities haven't disclosed a possible motive in those attacks.

11 injured

Eleven of the people wounded in Thursday's attack were taken to two Wichita hospitals, where one was in critical condition, five were in serious condition, and five were in fair condition Friday morning, hospital officials said. The others were taken to a Newton hospital, and their conditions weren't immediately available.

Walton said his office served the suspect with the protection from abuse order at around 3:30 p.m., which was about 90 minutes before the first shooting happened. He said such orders are usually filed because there's some type of violence in a relationship, but he didn't disclose the nature of the relationship in question.

While driving to the factory, the gunman shot a man on the street in the nearby town of Newton, striking him in the shoulder. A short time later, he shot someone else in the leg at an intersection.

"The shooter proceeded north to Excel Industries in Hesston, where one person was shot in the parking lot before he opened fire inside the building," the department said in a release. "He was seen entering the building with an assault-style long gun."