A motive remains unclear after a gunman opened fire on police at the site of a traffic crash in Fargo, North Dakota, killing one officer and wounding two others before a fourth officer killed him, authorities said Saturday.

The shooter was identified as Mohamad Barakat, 37, of Fargo, Chief David Zibolski said, though he provided few details about him or the shooting.

Officers responded to what Zibolski called a "routine traffic accident" at a busy intersection on Friday when Barakat, who did not appear to have been involved in the crash, opened fire.

Officer Jake Wallin, a 23-year-old military veteran, was killed, and officers Andrew Dotas and Tyler Hawes were wounded. Officer Zach Robinson shot and killed the suspect, the chief said.

CONNECTICUT SHOOTING LEAVES 1 DEAD, 3 IN CRITICAL CONDITION, INCLUDING GIRL, 17

officer Jake Wallin

Police officer Jake Wallin, 23, had been on the force for three months when he was killed in the shooting on Friday. (The City of Fargo via AP)

A 25-year-old woman was also injured, though authorities did not say how she was hurt.

Police officers Andrew Dotas, Tyler Hawes, Zach Robinson

Police officers Andrew Dotas, far left, and Tyler Hawes were both injured in the shooting. Police officer Zach Robinson, far right, shot and killed the gunman. (The City of Fargo)

Wallin had been a Fargo police officer less than three months and was in the field as an officer in training at the time of the shooting. Wallin had served in the Minnesota Army National Guard and was deployed to Afghanistan before becoming a police officer.

"He served his country, came back here and wanted nothing more but to serve in a position with purpose and meaning – his exact words — and he did that," Zibolski said.

Witness Chenoa Peterson told the Associated Press that the gunman appeared to ambush the officers from behind a car in a bank parking lot near the accident.

"He was holding up the trunk of the car with his arm, and then I see the gun come up, and he set it on his shoulder and just pointed it directly at an officer in front of him," Peterson said. "It was like 10 shots right away."

PHILADELPHIA POLICE VETERAN DIES AFTER BEING FOUND UNRESPONSIVE IN CAR

After the shooting, officers swarmed a residential building about 2 miles from the shooting, evacuating residents and gathering evidence.

Zibolski said he was confident that investigators would determine the motive.

CLICK TO GET THE FOX NEWS APP

The state Bureau of Criminal Investigation and the FBI are investigating the situation.

The Associated Press contributed to this report.