Beaches across Scotland are being contaminated with sewage this summer in breach of legal safety limits, endangering the health of swimmers, surfers and children splashing around in the sea.

Last year ministers claimed that for the first time all the country's official bathing waters met the European Union's 30-year-old sewage limits. But this year, barely halfway through the bathing season, two beaches have already failed the limits, and another nine are at risk of failing.

The breaches have been attacked as "totally unacceptable" by environmentalists and accepted as "disappointments" by the Scottish Environment Protection Agency (Sepa). The blame is laid on heavy rain, which can wash animal faeces off the land and cause sewers to overflow.

The most polluted bathing water so far this year is at Eyemouth in the Borders, where three out of eight water samples taken since 24 May have contained higher concentrations of faecal coliforms than permitted. This means that the beach is bound to fail for the year.

According to Sepa, water in Eyemouth bay was turned brown by two burns swollen by rainfall and contaminated with "faecal indicator organisms". Investigations into the source of the contamination are under way, including "impacts from agricultural activities".

The other bathing water that has already failed for the summer is Sandyhills near Dalbeattie in Dumfries and Galloway, where two out of nine samples have breached faecal limits. Sepa blames "high levels of surface water run off and overflows".

Nine other beaches, mostly on the south west coast, have so far recorded a single sample failure. If any of them suffer a second sample failure over the next two months, they are likely to be deemed as failures for the season.

The campaign group, Surfers Against Sewage, pointed out that polluted water contained vast numbers of dangerous bacteria and viruses.

"Coming into contact with these when swimming or surfing is a serious health risk and can lead to gastro-enteritis and ear, nose and throat infections, as well as more serious illnesses such as hepatitis A," said the group's scientific officer, Andrew Knights.

"It is totally unacceptable that so many of Scotland's beaches are still struggling to meet basic European water quality standards that are over thirty years old. With new, tighter standards coming in over the next few years, we could see a situation where much of Scotland's coastline is deemed 'off limits' to water users".

Sepa said that the 2007 bathing season had got off to a great start, with good results at all the 61 official bathing waters. But, the government watchdog admitted, "results by midsummer have been more variable with some disappointments".

According to Sepa's water quality expert, Calum McPhail, the failures were due to heavy rain over the last fw weeks. "This means some poor sample results were unavoidable but, thanks to Sepa's electronic signs at several Scottish beaches, the public are being kept informed on the quality of water at these beaches."

The Marine Conservation Society warned that the number of beaches achieving pass marks may have peaked. "Storm-related pollution, driven by climate change, is now a serious threat to Scotland's coastal waters," argued the society's coastal pollution officer, Thomas Bell.

"The very wet summer across the whole of the UK has led to periodic deteriorations in bathing water quality, and the south east and south west coasts of Scotland are among the areas hit."

Bell also pointed out that Sepa had cut the number of bathing water samples it takes every summer by a quarter since 2004. "We believe storm-related pollution to be the biggest growing threat to coastal water quality, and we would therefore like to see more information available to the public in future years, rather than less."

The Scottish Executive accepted that "a number of failures" had been caused by heavy rain and the lack of sunshine. "The weather itself will have dissuaded the majority of people from using beaches at times when there may be a potential risk to their health," said an Executive spokesman.

"Last year we achieved 100% compliance with the standards of the European Bathing Water Directive for the first time ever. We will continue to work closely with Sepa and others to ensure that further failures are kept to a minimum by ensuring appropriate measures are applied where necessary."Europe's safety limits for bathing waters are set to be significantly tightened up over the next few years, meaning that more beaches are likely to fail in the future. In 2006, Sepa estimated that as many as 18 Scottish bathing waters could breach the new standards.

Ministers recognise this as a major problem they will have to face. "European benchmarks are being revised and uprated all the time and we will have to work hard to keep up with them," said the Executive spokesman.