Deputy Bill Myers, 64, was working in Shalimar when he was struck by multiple bullets, including in his head and back.
The suspect, Joel Dixon Smith, was later killed in a hotel shootout with a tactical team, officials said.
"Deputy Myers has been a treasured part of this agency's family since 1989," Sheriff Larry Ashley said of the deputy who had retired two years ago then came back to work part time earlier this year. He was loved, admired, and respected for his dedication to the law enforcement profession.
"He loved photography and he had an ability to make those around him smile, especially his young granddaughter who he adored and took to Disney World as often as he could."
Myers had come back to work to earn a little money to take his granddaughter to the theme park, the sheriff said.
The sheriff told reporters he spoke to Myers' wife and one of his sons.
"They are devastated," Ashley said.
Myers had served the papers, which prohibited Smith from having contact with his spouse, at the office of the suspect's lawyer and had talked to the suspect about surrendering his firearms, the sheriff said.
Smith told Myers that his guns were in his truck. As they walked to the parking lot, Smith shot Myers, according to Ashley. There were four shell casings found at the scene but it wasn't immediately clear if Smith fired each round. Myers' gun wasn't in his holster, the sheriff said.
Because the event had been set up by Smith's attorney, who called authorities to tell them where to meet his client, it appeared Smith wasn't a threat.
"Certainly there was no indication ... that there was violence to be expected," Ashley said.
Myers died at Fort Walton Beach Medical Center.
The suspect fled and after being spotted by police raced to a hotel in Niceville where he barricaded the door of his room. The sheriff's Special Response Team arrived and after more than 100 minutes of negotiations, they fired tear gas into the room, authorities said. Smith came out with a handgun and was shot several times, Ashley said. He died at the same hospital as the deputy.
Gov. Rick Scott said: "Our hearts are broken to learn of the death of Deputy Bill Myers. Florida's law enforcement officers risk their lives daily to protect others, and any act of violence against these brave heroes is shameful and cowardly. My wife, Ann, and I send our sincerest condolences to Deputy Myers' family and brothers and sisters in Florida's law enforcement community."
Ashley said Smith was arrested in a domestic violence case in Walton County in 2008.
According to the Officer Down Memorial Page
, 27 officers have been killed by gunfire in the line of duty this year. Two others were fatally wounded during firearms training.