A beloved veteran police officer was fatally shot while serving a restraining order Tuesday morning in northwest Florida.

Okaloosa County Sheriff's Deputy Bill Myers, 64, was shot in the back of the head in a law office parking lot in Niceville. 

He was there to deliver a domestic violence injunction to the 33-year-old assailant, Joel Dixon Smith.

Myers had followed Smith, a postal worker, to his truck to retrieve weapons that were to be surrendered as part of the injunction. 

Smith then fled the scene and barricaded himself inside a motel room. He was shot dead by police after a two-hour standoff when he came out and drew his weapon. 

Myers underwent surgery, but died of his injuries after about three hours.

Myers had retired in 2013, but then rejoined the force in January on a part-time basis to help serve court papers.

The slain officer was reportedly saving money to take his granddaughter to Disney World.

PHOTOS: Slain Officer's Comrades Stand in for Him at Daughter's Wedding

Customer Carrying a Concealed Weapon Shoots Suspected Bank Robber

Report: Selfies Have Killed More People Than Sharks This Year

Pilot in Fatal GA Plane Crash Was Not Licensed