A gunman armed with what police called an "assault-style" weapon killed three people and injured 14 others at a factory in Kansas Thursday before he was killed by a police officer who rushed into the building alone.

All three victims and 12 of the injured were shot at Excel Industries, a plant in Hesston that makes lawn mower products, Harvey County Sheriff T. Walton said. Of those hurt, 10 were critically wounded, he said.

The shooter had been served a restraining order earlier in the day, Walton said Friday without elaborating. Authorities have not officially given the name of the gunman, but multiple co-workers identified the shooter to local media as Cedric Ford.

Investigators also withheld the name of the officer who killed the gunman, an officer Walton called a "tremendous hero."

The shootings began at about 5 p.m. local time, when the gunman was in a car and shot a man on the street in the nearby town of Newton, striking him in the shoulder. A short time later, another person was shot in the leg at an intersection. Authorities said the shooter stole the vehicle the second victim was driving. 

Data curated by FindTheData

"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 Hesston Police Department said in a release. "He was seen entering the building with an assault-style long gun."

Martin Espinoza, who works at Excel, was in the plant during the attack. He heard people yelling to others to get out of the building, then heard popping, then saw the shooter, a co-worker he described as typically pretty calm.

Espinoza said the shooter pointed a gun at him and pulled the trigger, but the gun was empty. At that point, the gunman got a different gun and Espinoza ran.

"I took off running. He came outside after a few people, shot outside a few times, shot at the officers coming onto the scene at the moment and then reloaded in front of the company," Espinoza told The Associated Press. "After he reloaded he went inside the lobby in front of the building and that is the last I seen him."

The Hesston officer responding to the scene exchanged fire with the shooter, who was killed. The officer was not hurt.

Walton said as many as 300 people were in the plant at the time of the shooting and that the law enforcement officer who killed the suspect "saved multiple, multiple lives." He said the gunman also had a pistol.

Erin McDaniel, spokeswoman for the nearby city of Newton, said the suspect was known to local authorities. She wouldn't elaborate.

A nearby college was briefly locked down.

Later Thursday night, several law enforcement vehicles surrounded the suspect's home in a Newton trailer park. The Harvey County Sheriff's Department initially said authorities believed the suspect's roommate could be inside. But McDaniel, the Newton spokeswoman, said later that the standoff had ended and no one was inside.

Hesston is a community of about 3,700 residents about 35 miles north of Wichita.

Excel Industries was founded there in 1960. The company manufactures Hustler and Big Dog mowing equipment and was awarded the Governor's Exporter of the Year award in 2013 from the Kansas Department of Commerce.

Kansas Gov. Sam Brownback issued a statement late Thursday, calling the shootings "a tragedy that affects every member of the community."

Walton said the FBI and the Kansas Bureau of Investigation had been called in to assist. A spokeswoman for the Kansas City office of the FBI did not immediately return a call seeking comment Thursday night.

"This is just a horrible incident. ... There's going to be a lot of sad people before this is all over," Walton said.

The shooting comes less than a week after authorities say a man opened fire at several locations in Kalamazoo, Michigan, leaving six people dead and two severely wounded.

The Associated Press contributed to this report.

Click for more from KWCH.com.

Click for more from KAKE.com.