The weapon accidentally went off while inside the National Police officer’s cabin baggage as he handed it to the pilot for safe-keeping, as protocol requires.
The incident caused no damage but the flight to Madrid on Saturday was delayed by half an hour.
Several passengers heard the shot and could smell the gunpowder but were reassured over the incident and the flight departed without further problems.
Roger Sales, from the Ibiza state administration told the local Diario de Ibiza that it was a minor incident.
"The weapon was discharged while following established protocol and nothing more," he said explaining that police officers are required to hand over their service weapon to the pilot to be locked in the cockpit during the flight.
Meanwhile, the National Police have launched an internal investigation.