Prime Minister David Cameron has bowed to pressure to enshrine in law the state's duty to look after the welfare of the armed forces and their families.
He said the military covenant would be put on a statutory footing for the first time.
Defence Secretary Liam Fox will give details of the move to MPs tomorrow, publishing a new Tri-Service Covenant which sets out rights to services such as health, housing and education for forces' children.
Amendments to the Armed Forces Bill will incorporate the principles of the covenant.
The legislation originally included only an annual review of how the informal agreement was being met - leading to accusations Mr Cameron had broken a pre-election pledge to make it law.
A campaign led by the Royal British Legion was joined by Labour and a Tory backbencher had raised the prospect of a damaging Commons revolt by tabling his own bid for formal legal recognition.
Signalling the change of direction Mr Cameron said: "The high esteem we all have for our armed forces will soon be given the recognition it deserves - as part of the law of the land."
Writing in the News of the World, which has campaigned on the issue, he said: "I'm keeping my word. We owe them. If we are asking our armed forces to do dangerous jobs in places like Afghanistan and Iraq, we have to ensure that we are doing everything we can for them in return.
"The historic agreement we have reached means that, for the first time, the value we place on those brave men and women who put their lives on the line will be written down for all to see."
The Bill will make clear that no-one should be disadvantaged because of their military service and, beyond that, that special treatment could sometimes be justified.
Ministers have been wary of the prospect of facing court challenges over failures if the legitimate expectations were made explicit on the statute book.
But the controversy has served to highlight concerns that military personnel are failing to be provided with the level of service they are entitled to in areas such as health, housing and pay.
Traditionally the covenant was an Army document, detailing the treatment soldiers could expect from the state, but it had effectively been extended to the other services over recent years.
The new document will formalise that comprehensive approach and include a wide range of areas -with some rights expected to be more generous than at present.
An annual report on government compliance with the covenant will be written by the Defence Secretary with "key stakeholders" and published alongside an independent expert review.
Dr Fox is expected to set out a number of enhanced services for the military, such as doubling the rate of council tax relief to 50% for those serving overseas, a £3 million boost for schools with high numbers of children from forces family and making it easier for seriously injured service personnel and veterans to access cut-price public transport.
Shops and public sector organisations will also be encouraged to take part in a discount card scheme for veterans and action will be promised to improve military inquests and to provide those with genital injuries access to IVF treatment.
The Royal British Legion termed the move "an historic breakthrough" which would benefit servicemen and their families "for generations to come".
Director general Chris Simpkins said it would also help Parliament to scrutinise the treatment of the Armed Forces and their families.
"We are particularly pleased that the unique nature of Service will now be acknowledged in the Bill, together with the principle that no disadvantage should arise from Service - real issues for members of the armed forces," he added.
"This is an impressive package of support, but even more impressive is the irrevocable legacy of at last getting the principles of the Armed Forces Covenant written into law. This is a major step forward for the whole Armed Forces community."
However, shadow defence secretary Jim Murphy branded the decision a retreat from an "inevitable defeat" in Parliament in the face of "real anger" from forces families and MPs.
Labour examined the possibility of enshrining the covenant in law while it was in office.
Writing in the News of the World, Dr Fox promised the measures were "only a start in our Armed Forces Covenant".
"Our armed forces risk their lives and sacrifice much of their freedom for us," he said. "The nation has a moral obligation to ensure they get the support they need."
Admitting it "won't be easy to rebuild the military covenant", he added: "There isn't the money to do all we want but we will act where we can."Reuse content