Image copyright Police handout

Two sheriff's deputies in Florida have been killed after a gunman shot them through the window of a restaurant where they were eating, police say.

"I don't have answers to why this happened," Gilchrist County Sheriff Bobby Schultz told reporters.

Deputy Taylor Lindsey, 25, and Sgt Noel Ramirez, 29, were eating at a Chinese restaurant in the small town of Trenton when they were shot.

The suspect, John Hubert Highnote, 59, died at the scene, police say.

Police have yet to establish a motive in the Thursday afternoon shooting.

"What do you expect happens when you demonise law enforcement to the extent it's been demonised? Every type of hate, every type of put-down you can think of," Sheriff Schultz said at a news conference, adding that the suspect was a "coward".

Media playback is unsupported on your device Media caption Florida sheriff: 'Law enforcement has been demonised'

"The only thing these men were guilty of is wanting to protect you and me. They just wanted to get something to eat, and they just wanted to do their job," he said.

Ramirez, a seven-year police veteran had a wife and two young children.

Lindsey had worked with the force for three years and had a girlfriend, police said.

"There was no crime in progress, no disturbance. The suspect appears to have walked to the front of the business and shot both men without warning," Sheriff Schultz said.

You may also be interested in:

According to local media, Highnote was found dead from what appeared to be a self-inflicted gunshot wound inside a vehicle outside the Ace China restaurant.

Florida State Attorney Bill Cervone told the Gainesville Sun newspaper that the crime appears to be "inexplicable".

"It appears he just walked up and shot them, then went to his car and shot himself.

"People will want to know why and we may never have an answer for them," he said.

Media playback is unsupported on your device Media caption Eric Garner death inspires an unlikely police experiment

US President Donald Trump, who is currently at his Mar-a-Lago resort in Florida, tweeted his condolences.

Police say the suspect was from the small town of Bell, not far from where the attack occurred.

Few details are known about him.

In 1978 he was accused of carrying a concealed weapon, but charges were later dismissed.

He also had a series of minor traffic violations, most recently in 2012.

The officers' deaths come at a time of tense police and community relations across the US, following a string of police shootings that resulted in the deaths of unarmed black men.