EU governments have agreed sweeping plans to outlaw discrimination at work, with Britain winning exemptions for the armed forces from rules on age and disability.

Governments have been given three years to ban discrimination on grounds of sex, race and religion and an extra three years if they need it to tackle age and disability.

Many of the provisions are already in force in different member states but the aim of the new euro-rules is to ensure anti-discrimination law applies equally in all 15 member states.

The UK was adamant the military had to be excluded from the age and disability clauses, amid fears the legislation could otherwise open the door to legal action by disabled and older people who are denied entry into the armed forces.

Balance Ireland had joined the UK in demanding comprehensive exemptions for religious groups.

After the deal was hammered out at talks in Luxembourg, employment minister Tessa Jowell said: "The directive marks a new chapter in workplace rights and responsibilities and the Government is pledged to ensure its implementation strikes a fair and sensible balance.

"We have fought hard to ensure the directive is workable in practice and does not burden business, schools and other organisations."

She also welcomed a deal protecting religious groups from having to apply inappropriate anti-discrimination measures.

"Religious schools can discriminate in favour of their own religions. This offers complete protection for religious schools."

A Government spokesman said the final deal ensured exemptions would be allowed "where there are genuine occupational requirements for discrimination".