A man was sentenced to 60 years in prison on Tuesday after pleading guilty in the 2018 fatal shooting of a Fort Worth police officer, prosecutors said.

Samuel Mayfield, 37, pleaded guilty to a murder charge in the slaying of Garrett Hull, an officer who was promoted to corporal after his death. Mayfield didn't shoot Hull, but he was one of three men officers were pursuing after a robbery at a bar when Hull was killed, Tarrant County prosecutors said.

Police said that Mayfield, Timothy Huff and Dacion Steptoe were confronted by Hull and a team of undercover and uniformed officers after the trio robbed a Fort Worth bar. The three men ran in different directions when they saw the officers.

FORMER TEXAS POLICE OFFICER CONVICTED OF MANSLAUGHTER IN FATAL SHOOTING OF ATATIANA JEFFERSON

Man gets 60 years in prison in slaying of Fort Worth officer

A Texas man sentenced 60 years in 2018 fatal shooting of police officer he didn't commit. Three suspect fled from the scene of a robbery in 2018 resulting in the death of an officer and the suspect who shot him. 

CLICK HERE TO GET THE FOX NEWS APP

Steptoe opened fire, killing Hull, prosecutors said. Then another officer fatally shot Steptoe.

Mayfield and Huff were arrested and charged in Hull's death, prosecutors said. Prosecutors said that Texas law allows a person to be criminally responsible for the actions of someone else if there's a conspiracy to commit one crime and another felony occurs.

Huff was found guilty of capital murder last year and sentenced to life in prison without parole.