Let assume the Danish capture the people that bomb their embassy, is it wrong for Denmark to punish these people?
Of course not, for the same reason that people living in occupied Afghanistan (or refugees from the war) are perfectly within their rights to kill any Danes.
But what if they find those people who bombed the embassy are victims or relatives of victims who suffered bombing in Afghanistan or are fighting their cause? Then, is it right to punish these people?