Robotic swarms have a great potential to solve in a simple way, without the need for a central controller, a wide range of difficult real-world problems, such as transportation, search and rescue missions etc. While there are important results in what regards the emergence of complex behaviors from very simple interacting robots, the security of robotic swarms remains a problem which did not get the proper consideration. With the overall goal of enabling the full distributed security of a robotic swarm, the contributions of this paper are threefold. First, a bioinspired framework based on membrane computing (P colonies) is proposed for approaching this issue. Secondly, the functionalities of a P colonies simulator are presented and finally, the notion of P swarm is introduced as a relevant new formal model of safe interactions between robots in a swarm.