Peers have defeated the Government in backing a move aimed at ensuring troops accused of the most serious offences are normally tried in a civilian court.
The House of Lords supported the presumption against such cases being dealt with by the military justice system by 210 votes to 190, majority 20.
The change in the upper chamber to the Armed Forces Bill means service personnel alleged to have committed in the UK the most severe crimes, such as murder, rape and child abuse, would be dealt with in the civilian courts rather than a court martial, unless authorised by the Attorney General on grounds of complexity.
The legislation renews the statutory basis of the British military every five years.
It will also further incorporate the Armed Forces Covenant into law and makes several changes to the service justice system.
Labour former Attorney General Lord Morris of Aberavon argued military personnel should have the same legal safeguards as civilians.
He said: "Every service person should have the same protection by his or her day in court as a civilian counterpart. Our forces are now much closer to those in civilian life than they were and should have the same rights, hallowed and developed over centuries, as civilians."
Former Lord Chief Justice and independent crossbencher Lord Thomas of Cwmgiedd said: "We have always tried and marked the seriousness of crimes… by trial by jury. Magna Carta conferred on defendants the right of trial by jury.
"Today we take account of the interests of the victim of such crimes and they only have confidence in trial by jury. Particularly in so many of these cases, they turn on credibility, and on that the judgment of ordinary men and women, drawn from a jury, are the only way to achieve justice."
Opposing the proposed legislative change, Defence Minister Baroness Goldie pointed out a review had supported the continued existence of the service justice system and found it to be "fair, robust and capable of dealing with all offending".
The creation of a Defence Serious Crime Unit in the Bill "will further improve the skills and capability of the service police to deal with these more serious offences", she said.
The minister added: "We do not, therefore, believe the presumption in favour of these offences being heard in the civilian courts is necessary, appropriate or justified."