Vending machines stocked with sweets, crisps and sugary drinks will be banned from French schools from September next year following the introduction of new measures to combat obesity.
The controversial ruling, part of the public health Act which completed its passage through parliament last week, will also require advertising for junk food to include a health warning.
The passing of the Bill represents a major victory for doctors and consumers' groups, overturning an attempt by senators to water down the measures in the face of intensive lobbying from powerful food manufacturers.
The national assembly had approved the measures in April, when health minister Philippe Douste-Blazy told MPs that child obesity and weight problems had tripled in 20 years and now affected 16 per cent of children in France.
But in July, following pressure from the food industry, the Senate approved amendments which reversed a ban on school vending machines - specifying instead that the nutritional composition of the products sold should be controlled - and reduced proposed restrictions on television advertising aimed at children.
In response, protesting nutritionists and paediatricians sent an open letter to Mr Douste-Blazy calling for "a coherent public health policy for nutrition".
By last week, nearly 850 health professionals and medical researchers had signed an accompanying internet petition. The letter described school vending machines as a "striking example" that highlighted the "risk of contradiction" between nutritional advice and practice.
The letter said: "Today, these machines offer only sweet, fat andor salty processed products. This shocking contradiction between the message given to children and parents and the reality on offer can only be disastrous educationally." To be credible to the public, nutritional information had to be "independent of economic forces", it added.
Last week, a joint commission of MPs and senators met to sort out the stalemate and revoked the Senate decision. Then, last Friday, the two houses of parliament ratified the prohibition in primary and secondary schools of "automatic vending machines selling drinks and food products accessible to pupils".
But calls by health and consumer associations for a ban on television advertising of junk food aimed at children were less successful. Adverts will have to display an approved health warning, or manufacturers will risk having to pay a charge equivalent to 5 per cent of their advertising budget to a health education institute.
The French food health and safety agency AFSSA said that research in the United States showed clear links between child obesity and television advertising for junk food.
The agency said that nearly half of child-targeted advertisements in France were for sugary or chocolate snacks, drinks, sweets, biscuits or puddings.