A Springville man shot and killed during an exchange of gunfire with police, which also resulted in an officer being injured, was a former police officer who was exhibiting strange behavior in the weeks leading up to the fatal confrontation.

That's according to 4th District Court documents that provide a glimpse into the odd behavior of Mathew Scott Nielsen, 46, was showing prior to the shootout.

Just before 5 a.m. on March 19, Springville police received reports of shots being fired in the area of 1500 West and 150 North. One caller reported hearing "semiauto rapid fire" while a second caller reported hearing eight to 10 shots fired in rapid succession," according to Springville police.

Officers searched the area for 30 to 50 minutes before coming across a car that had struck a concrete barrier near 1200 West and 1000 North.

As soon as the first officer stepped out of his patrol car to investigate, Nielsen shot at him, striking the officer in either the leg or knee, according to police. A second officer arrived a short time later from a different angle and exchanged shots with Nielsen. Not long after, officers reported that the gunman was "down," according to search warrant affidavits.

Both officers were treated for injuries at local hospitals and are expected to make a full recoveries, according to police.

"The officers reported the suspect was wearing camouflaged clothing, and possibly had been wearing body armor," according to one of several affidavits.

The Utah County Officer Involved Critical Incident Protocol Team is investigating the police shooting. The team has since learned that the vehicle Nielsen was driving was also involved in a couple of other recent incidents with police.

"The vehicle was stopped on a traffic stop a couple days prior to the officer-involved incident by an officer who said he was 'badged' by the driver," the affidavit states. "Another statement was made that a different Springville officer reported stopping the same vehicle a couple weeks prior to this incident and was also shown a law enforcement badge."

Springville police say in the traffic stop just prior to the shooting, Nielsen presented a badge to the officer who pulled him over and mentioned "something to the effect of being a retired officer."

Police conducted a background check on Nielsen and discovered that he had a "revoked concealed carry permit license. His record shows that he is a former law enforcement officer," investigators wrote in the affidavit.

Inside Nielsen's vehicle that struck the concrete barrier police found a badge that says "Joint Criminal Apprehension Task Force." The JCAT team was a multi-agency group lead by the U.S. Marshals Service, that rounded up wanted fugitives across the state, but began downsizing and focusing its efforts about 10 years ago. They are now called the Violent Fugitive Apprehension Strike Team. The court documents do not indicate whether Nielsen was actually a member of the task force team.

Investigators also talked to Neilsen's mother who said "she had been receiving unusual messages from Mathew the night prior to the incident." Some of those text messages from Nielsen included, "Is there some guys by my house?" and "Nothing is OK," according to the warrants. Just a few hours before the shootout, Nielsen sent a string of messages that included, "C hmm," "Still down I pup," and "So yeah for me!!!!!"

"Mathew's mother was not sure how to interpret these messages but suggested they were strange," investigators wrote in their affidavit.

One of the warrants seeks to collect any information from Nielsen's other electronic devices.

"Officers believe Mathew may have sent additional messages to individuals reflecting his state of mind or any plans that he may have had to injure himself or others that evening. Officers believe Mathew had premeditated his actions against police officers due to the police attire he was wearing, the way he was positioned on the ground with firearms, and the way he ambushed officers and shot one of them in the leg," the affidavit states.

Online, several of Nielsen's friends have stated that he was a kind and caring person but struggled with mental health issues in recent years.

At the conclusion of their investigation, the Utah County Officer Involved Critical Incident Team will present its findings to the Utah County Attorney's Office.