If you don't respect human rights while implementing counter-terrorism measures, you alienate communities, encourage radicalisation, put communities one against the other, he said on the fringes of a two-day international conference on the protection of human rights and strengthening of democracy in Europe which opened in Zagreb on Thursday.
If you implement security measures while acknowledging the different communities and their rights, societies are safer in the end, O'Flaherty said.
In other words, it's not that one man's loss is another main's gain, he added.
Counter-terrorism efforts must respect some fundamental human rights principles, there must be clear laws which people can understand, and rights can be restricted only if you prove that it's really necessary so that something good can be achieved, O'Flaherty said.
Even in that case, you can't encroach upon those rights too much, only as much as necessary to achieve a goal, he added.
What we must do much better is help people in Europe understand that most human rights are subject to restrictions, that they are not absolute. The right to freedom of expression, freedom of movement and freedom of assembly are rights which the state can restrict as long as you respect the fundamental principles of human rights, O'Flaherty said.
He said people were reasonable and willing to cooperate if they were well-informed. Respect people and you will get a level of cooperation which could surprise you, he added.
O'Flaherty is deeply convinced that security and human rights can go hand in hand.
The EU's formal commitment to human rights protection in the light of the migrant crisis is fantastic, he said, but conceded that the situation on the ground was a little different.
His agency reports on migrants' human rights around the EU every month and faces unacceptable patterns of poor reception conditions, lack of adequate health care and human dignity issues, for example. However, he is confident that it will get better.
I'm optimistic and encouraged, but I'm not saying we are doing everything perfectly. We do many things badly, he said.