A veteran Florida police officer resigned Tuesday after a prank involving a toy bomb backfired, resulting in the evacuation of an administration building, officials said.

The Pinellas County Sheriff’s Office said in a news release the incident happened around 3 p.m. when Lieutenant Joseph Gerretz opened a package at his desk he'd received through inter-office mail from Deputy James Piper, 59.

When Gerretz opened the box, he discovered a red cylinder with protruding wires safely ensconced in plastic packaging. He also found a one-word handwritten note -- reading “Boom” -- according to the sheriff's office.

ARIZONA POLICE OFFICER FATALLY HIT DURING TRAFFIC STOP, OFFICIALS SAY

"Upon opening the box, seeing the handwritten note and the wires, he immediately vacated his office and made notification of the potential threat," police said.

The entire Sheriff's Office Administration Building in Largo, Fla. was then evacuated as a K9 bomb detection dog was called to the scene.

POLICE SUICIDES RISING, UNION SAYS MEDIA VILIFICATION IS ‘LEADING CAUSE OF DESPAIR’

The K9 did not alert to the suspicious package, and the Tampa Police Department's bomb team eventually confirmed the suspicious device was just a toy.

CLICK HERE TO GET THE FOX NEWS APP

After Sheriff Bob Gualtieri sent an agency-wide message about the evacuation, Piper notified his supervisor and informed him he sent the package to the lieutenant as a joke, police said.

"The supervisor notified his chain of command," the sheriff's office said. "Deputy James Piper resigned effective immediately."

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