It can certainly get complicated, PP.
For example, a British man could travel to a country where it's lawful for him to have sex with a 15yo girl. If he does so, the authorities in that country clearly can't act (because he hasn't broken their laws) but he can still be prosecuted when he arrives back in the UK. So, in effect, the UK is claiming that British laws can apply in other countries.