Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

A Florida sheriff's deputy's idea of humor cost him his job.

Pinellas County Sheriff's Deputy James Piper resigned on Tuesday after he admittedly sent a toy bomb to a colleague as a joke, which led to an evacuation at an administration building, authorities said.

A patrol deputy has resigned after he admittedly mailed a toy bomb to a Sheriff's Office lieutenant as a joke causing an evacuation at the Sheriff's Administration Building Jan. 8, 2019. Pinellas County Sheriff's Office

Lt. Joseph Gerretz was in his office at the Sheriff’s Administration Building in Largo, Florida, at about 3 p.m. ET on Tuesday, when he received a package through interoffice mail from Piper.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Gerretz, 46, opened the insulated box and found a red cylinder-shaped object with protruding wires, according to the sheriff's office.

A handwritten note with the word “Boom” was included inside the package, authorities said.

"Upon opening the box, seeing the handwritten note and the wires, he immediately vacated his office and made notification of the potential threat," the sheriff's office said in a statement.

Parts of the Sheriff's Administration Building was evacuated and a bomb-sniffing dog was called to the scene. Members of the Tampa Police Department's bomb team also responded and determined the device was a toy bomb.

After Sheriff Bob Gualtieri sent an all-clear message, Piper, 59, contacted his supervisor and informed him that he sent the package to the lieutenant as a joke.

Piper was hired at the sheriff's office in 1982 and left in 2015. He was rehired in 2017, the sheriff's office said.