Mark Sedwill’s comments are the clearest signal yet that a number of captured fighters, held by Kurdish-led forces in detention camps, could be repatriated.
He was responding to a question about foreign fighters at an international conference in Bahrain on Saturday.
Mark Sedwill, who also holds the post of cabinet secretary, said: “We want those who are captured dealt with through the justice system and they have to be dealt with through the justice system in the most appropriate place possible.
“If we can bring them back to the UK and put them through our criminal justice system and deal with them appropriately, we will. If it is better done elsewhere, then we will work with allies to do that.
“Many of the crimes that these individuals have committed have been committed for example against our allies and partners in Iraq and it may well therefore be appropriate for them to be dealt with there.
“But they will be dealt with and they will be dealt with in the most appropriate place possible.”
British Islamic State fighters will be brought back from Syria if they can be prosecuted in the UK to the UK to face prosecution.
Mark also suggested more British children of IS parents could be brought home following the repatriation this week of a group of orphans.
He added: “These are young British citizens who, through no fault of their own because of the decisions of their parents found themselves in a war zone and we felt it was the right thing to do, once we were able to do so, to repatriate them.
“If others find themselves in the same circumstances and it is possible to do so then the same principle will apply. But people should not underestimate the practical challenges, the security challenges of doing that.”
He told the International Institute for Strategic Studies’ Manama Dialogue that the parents of children stranded in Syria were ultimately to blame for their suffering.