The roughly 15-metre (50-foot) creature swam into the old port in the centre of the Mediterranean city around lunchtime and blocked the entrance, drawing a crowd of curious onlookers who watched as divers attempted to free it.
Responding to reports of a whale-like mammal which "seemed disoriented", a spokesman for local rescue services said it was the first time police had been called to respond to such an incident.
The local police department tweeted out several photos of the rescue operation (see below).
A variety of whales, dolphins and porpoises are known to live in the Mediterranean.
Earlier this month, at least a dozen injured dolphins washed up on beaches on the southern French coast, leaving local maritime officials baffled.