This particular problem of forty-city-games is long and well known to the board. Though, we have no solution to it yet.
Several people reported of 'entering Edibourgh, then immiditely leaving'. After a couple of attempts, finally, you may attack the pirate's base - probably. No guarantee. I tried and failed (maybe I misunderstood).
Here's a
thread (in German language). You' could read on your own there. Shall I?
And, over all, obliterating a pirate's stronghold doesn't pay well (in means of benefit). Probably you'd better stay away from it. There are easier missions on your way to become Eldermann. Chasing the notorious pirate for instance. Or settling a new town (not for 40-maps of course).