Forty-five people, including babies and toddlers, have fallen violently ill in recent months from a strain of food poisoning found in Cadbury chocolate bars, according to public health officials.

Shopkeepers were withdrawing more than one million Cadbury bars from sale last night amid concern about the threat posed by batches of Dairy Milk contaminated with salmonella.

Twenty-two children under four, including eight babies, have suffered diarrhoea, fever and abdominal pain in the outbreak of the potentially fatal condition, which has been going on for five months.

The Food Standards Agency advised Cadbury to withdraw seven products, including Dairy Milk Caramel, Dairy Milk Mint and Dairy Milk 8 Chunk.

The recall - one of the biggest in British retail history - will cause the company a logistical nightmare, embarrassing publicity and a bill that could top £1m.

It brought comparisons with the Sudan 1 scare in February last year when the discovery of carcinogenic food colouring in Worcester sauce, leading to the recall of 400 products, though no one fell sick during that alert.

Cadbury said the contamination had occurred from a leaking water pipe at one of its factories. It insisted its chocolate bars were safe and that the withdrawal was a "precaution".

But Cadbury-Schweppes, the FTSE 100 company which owns the brand, may face to questions about why it took so long to identify the source of the contamination and to withdraw the bars.

Routine testing of chocolate at its Marlbrook plant in Herefordshire picked up low levels of salmonella in January, Cadbury said yesterday. However, production continued and the company took "about six weeks" to trace the infection to a leaking pipe, at the end of March.

The Health Protection Agency, the government body dealing with food poisoning, said 45 people had contracted the strain of salmonella montevideo between 1 March and Monday.

"Investigations so far show the strains isolated from cases and from one confectionery company are the same. But the investigations are ongoing and it's impossible to draw conclusions," a spokeswoman said. The agency has not linked any other product or food company to the outbreak.

The Food Standards Agency said it had been contacted by Cadbury on Monday about the contamination.

"Throughout the week we have been gathering further information until we asked them [Cadbury] today to do a product recall," a spokeswoman said.

"Salmonella can cause sickness and diarrhoea and we are advising people not to eat these products and to contact Cadbury customers services."

Health officials are so concerned because salmonella can be deadly. Last year in England and Wales there were 11,415 cases of salmonella, which mostly affects the elderly, children and people who are already ill.

A Cadbury spokesman said traces of the bug were picked up in routine testing at Marlbrook, whose chocolate crumb goes to factories in Birmingham and Somerdale, near Bristol, to be turned into milk chocolate.

"The levels are significantly below the standard that would be any health problem, but we are taking this measure as a precaution," the spokesman said.

"If people have eaten one of these chocolate bars today they should not worry, but they can get in touch with us if they are concerned for a full refund."

The products affected are the 250g Dairy Milk Turkish, Dairy Milk Caramel and Dairy Milk Mint bars, the Dairy Milk 8 chunk, the 1kg Dairy Milk bar, the 105g Dairy Milk Buttons Easter Egg and the Freddo bar.

Uneaten products should be returned to Cadbury Recall, Freepost MID20061, Birmingham B3O 2QZ for a refund. Cadbury's free helpline is 0800 818181.