Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A gunman who rampaged across two Kansas towns, killing three and wounding 14 others, was served with a restraining order at his workplace just 90 minutes before the attack ended in bloodshed there, officials said Friday.

The protection of abuse order, first filed by a live-in girlfriend earlier this month, may have triggered Cedric Larry Ford in the chaotic shooting spree in Newton and Hesston, about 30 miles north of Wichita, authorities said.

Ford, 38, was armed with an assault rifle and semi-automatic pistol as he began randomly shooting. His six-mile trail of violence lasted just 26 minutes — from when the gunman shot and injured a person at about 5 p.m. local time (6 p.m. ET) Thursday and stole a truck, until the first police officer on the scene shot him dead.

An undated handout booking photo provided by the Harvey County Sheriff's Office on 26 February 2016 shows Cedric Ford. Harvey County Sheriff via EPA

Ford was killed at Excel Industries, a lawn-care company in Hesston where he worked.

Fifteen of the victims were shot inside the building — including all three who died, Harvey County Sheriff T. Walton first said at a news briefing Thursday night.

Walton identified the victims Friday as Renee Benjamin, 30; Joshua Higbee, 31 and Brian Sadowsky, 44.

Five of the wounded remained in serious condition.

Walton told NBC News on Friday that Ford used the assault rifle during the attack, but did not appear to fire his pistol.

The sheriff, when asked about a possible motive, said a deputy had served the shooter a protection from abuse order at Excel around 3:30 p.m. It was the second such order he had received after failing to show up in court, Walton said.

"He was just shooting indiscriminately."

Walton at a news conference Friday morning declined to detail who requested the protection order, saying the investigation was still in its early stages.

According to the paperwork, which was obtained by NBC News, a woman who filed the order Feb. 5 told the court that she was in a relationship with him and they were living together, but he was "moving out."

She described an incident that day that became heated after a verbal argument. She wrote that he pushed and grabbed her.

"He placed me in a choke hold from behind — I couldn’t breathe," the woman's statement says. "He then got me to the ground while choking me — finally releasing me."

The sheriff said it’s possible the court order incited the workplace carnage.

"We always say it won’t happen here. Well here it is. It happened here," Walton told NBC News. "We’ll get through it. It’s a good community of good, strong people."

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Kurt Thompson, the director of the Kansas Bureau of Investigation, said Friday that investigators “have a lot of work to determine what happened and why.”

“We will be here until this task is completed,” Thompson said.

The FBI and the federal Bureau of Alcohol, Tobacco, Firearms and Explosives were on the scene but the sheriff said the incident was not related to "terrorism."

Kansas law doesn't require a permit to buy long guns or handguns, which don't have to be registered.

In just the last week, 11 mass shootings have brought terror and tragedy to our country. This is not the America we strive for. #Hesston — Gabrielle Giffords (@GabbyGiffords) February 26, 2016

An ATF official said they were investigating how Ford obtained the weapons.

Court records showed that Ford was a felon who previously lived in Miami and was on probation with a series of convictions in Florida, including burglary in 2000.

He had a criminal record stretching back to October 1996, when he was charged with carrying a concealed firearm when he was 18 years old, the records showed.

Law enforcement officials first became aware of Thursday's incident after being called to reports of two people shot and injured — one in the shoulder and one in the leg — on different streets across the two towns.

The gunman then drove north toward his workplace, where he shot another person in the parking lot, Walton said.

By the time the first police officer arrived at the scene, the gunman was "actively shooting at any targets that came into his sights," Walton added.

The officer — later identified by Kansas Gov. Sam Brownback as Hesston Police Chief Doug Schroeder — went in alone, killed the gunman and "saved a lot of lives," the sheriff said.

Walton said the shooter would have fired "until he was out of ammo. I don't know how much he had. … He was just shooting indiscriminately."

Police in the parking lot of Excel Industries in Hesston, Kansas, on Thursday. Fernando Salazar / The Wichita Eagle via AP

Another officer who arrived, Hesston police Sgt. Chris Carter, told reporters Friday morning that his adrenaline kicked in as he entered the building, where about 200 to 300 people were inside. Some of his relatives work at Excel, he said.

"What crossed my mind was finding the bad guy, protecting everyone else who was there," Carter said. “Overwhelming. But we’re on auto-pilot. We’re trained for these. We just do what we’re trained to do."

Carter, who was driving a pickup truck, managed to help one of the victims. Walton hailed Carter as "another hero."

A couple of hours later, Newton police and a SWAT team converged on a home in a Newton trailer park where the gunman was believed to have lived.

Walton told reporters that the shooter's roommate was inside and refusing to engage with officers — but when officials obtained a warrant and returned at 10 p.m., they found the property empty, NBC station KSN reported.

President Barack Obama expressed his condolences for the victims Friday, but said the country cannot become numb to gun violence.

The "real tragedy is the degree to which this has become routine," he told reporters. "Once a week we have these shootings and it doesn’t dominate the news, and that’s got to change."

Gary Emry, the city administrator of Hesston, said Obama had called him and Hesston Mayor David Kauffman on Friday.

One of the injured at Excel Industries was Dennis Britton, who was shot in the right buttock and suffered a fractured right femur, according to his father.

Dennis Britton Sr., also an Excel employee, told NBC News his son "made eye contact with [the shooter] when he walked away," and that he "heard a clap and hit the floor" after being shot.

"It's rough, I'm not going to lie to you," Britton said. "He was like all the rest of them there. He's a family man. He's got three kids and one on the way."

Martin Espinoza, who works at Excel, was in the plant during the shooting, he told the AP. 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 said. "After he reloaded he went inside the lobby in front of the building and that is the last I seen him."

Meanwhile, Excel's President and Chief Executive Paul Mullet said he did not know when the plant would reopen, his first priority being the victims' families.

Praying for the victims of this senseless act of violence, their loved ones and for the safety of all those in Hesston. — Pat Roberts (@SenPatRoberts) February 26, 2016

Please send your thoughts and prayers to the people of Hesston tonight. — Sam Brownback (@govsambrownback) February 26, 2016

"Excel family is deeply saddened by the horrific event that occurred yesterday," he told reporters Friday. "Our hearts go out to our employees and their families."

Kansas officials began paying their respects Thursday night.

Brownback called the shooting a tragedy Friday, and told reporters that it was too soon to discuss any need for stricter gun control laws.