A South Florida bomb-sniffing dog who has helped protect President Trump was shot and wounded in the line of duty Friday when he took a bullet meant for his two-legged partner.

K9 Kasper is recovering after being shot in the side when deputies with the Palm Beach Sheriff’s Office exchanged gunfire with a wanted stick-up man who was killed, Fox 13 Tampa reports. None of the deputies were injured.

“During the gunfire, PBSO K9 Kasper was shot while protecting his handler,” the sheriff’s office said in a Facebook post that included a photo of the wounded dog on a veterinarian’s operating table.

The sheriff's office posted video on Twitter Saturday of Kasper leaving the hospital to go home.

Kasper has protected Trump at times in Palm Beach, WPBF-TV reported.

Deputies say Phillip O’Shea, 46, was wanted in connection with an early morning hold-up at a West Palm Beach bar.

This Week in Pictures

They say O’Shea got away after firing shots at deputies and car-jacking a woman’s car.

About 13 hours later, three deputies spotted O’Shea in Jupiter, the Palm Beach Post reported. They confronted him in a parking lot.

Palm Beach County Sheriff Ric Bradshaw said O'Shea lived in West Palm Beach and had an extensive criminal history.

Bradshaw said O’Shea was wanted in Raleigh, North Carolina, in connection with a May 2 motel robbery.