[2.178] O you who believe! retaliation is prescribed for you in the matter of the slain, the free for the free, and the slave for the slave, and the female for the female, but if any remission is made to any one by his (aggrieved) brother, then prosecution (for the bloodwit) should be made according to usage, and payment should be made to him in a good manner; this is an alleviation from your Lord and a mercy; so whoever exceeds the limit after this he shall have a painful chastisement.
When jihadists mow down people with their cars and lorries and \ or cut their throats in the street this is one of the verses from the Koran that they can use to justify their actions. They would assume that western governments are killing muslims and that Allah wants them to exact retaliation. This verse says that Allah isn’t bothered about which member of the guilty community pays with his blood as long as the payment is made by someone of the same social status. In the case of Lee Rigby the soldier was taken for the imaginary soldier who has supposedly committed a crime somewhere in a Muslim country. Of course there does not have to be proof of a real crime. If a Muslim accuses a non-Muslim of a crime then he must have committed that crime regardless of whether he did or not. As a Muslim is a superior human being he cannot be at fault if he accuses a non-Muslim of a crime. That would be against Allah’s divinely ordained order of things and Allah knows best.
In the OT only the murderer himself can be put to death and not someone in his place:
Deuteronomy 24 v 16 The fathers shall not be put to death for the children, neither shall the children be put to death for the fathers: every man shall be put to death for his own sin.