This is a Ichneumon Wasp (Hymenoptera: Ichneumonidae; Pimplinae) which as a group are parasitoids of lepidoptera (butterflies and moths) larvae or pupae. This is most likely to be Pimpla rufipes, which is one of the commonest species, although there are several near identical species. Pimplarufipes is a generalist parasitoid of moth pupae and is widespread an common in the UK. Although they look a bit fearsome they are harmless to us.