An Alabama police officer was shot to death in an ambush while assisting other officers during a vehicle pursuit, a mayor said Wednesday, and a suspect was charged with capital murder.

Kimberly Mayor Bob Ellerbrock told a news conference that officer Nick O'Rear was killed in a confrontation that authorities said began on Interstate 65 around 10 p.m. Tuesday. O'Rear was assisting officers from another department with a pursuit when the driver shot him, the mayor said.

Ellerbrock described the slaying as an ambush but declined to go into details. The state will investigate, he said.

OFFICERS KILLED IN THE LINE OF DUTY 2020

O'Rear had been with the department about a year. He was the father of two children, and another on the way, Ellerbrock said.

"It's a sad day. It's a horrible day," he said. Members of O'Rear's family were present during the news conference.

It began when police tried to stop a vehicle on the highway and the driver wouldn't pull over, news outlets reported. A patrol car from the town of Kimberly joined in.

After being shot, the officer was taken to a hospital for treatment but died.

Jefferson County jail records showed that a man publicly identified as a suspect in the shooting, Preston Chyenne Johnson, 37, was charged with capital murder in the shooting death of a police officer a few hours later.

2019 WAS ONE OF THE LEAST DEADLY YEARS FOR US POLICE OFFICERS IN YEARS: STATISTICS

Three other people also were arrested, according to police in Warrior, but it wasn't clear whether additional charges were filed.

Alabama Gov. Kay Ivey's office said she had called and spoken with the parents of the slain officer.

"The safety of our citizens and the rule of law is forefront on the minds of our officers who willingly risk their lives on behalf of ours. His sacrifice will never be forgotten," she said in a statement.

Seven officers were killed in the line of duty in Alabama last year. The chief federal prosecutor for north Alabama, U.S. Attorney Jay Town, sent a tweet expressing sorrow over the Kimberly officer's death.

CLICK HERE TO GET THE FOX NEWS APP

"The violence against law enforcement is maddening," Town said.

Johnson has been arrested multiple times on drug possession and other charges over the last decade, court records show. It wasn't immediately clear whether Johnson had an attorney who could speak on his behalf.