The Government's pollution watchdog has been forced to drop a system it has used to avoid testing popular beaches on days when contamination is likely to be at its worst.

Condemned for "cheating" by environmental campaigners, Sepa has been ordered by the Scottish Environment Minister, Paul Wheelhouse MSP, to correct the way it monitors pollution this summer.

This weekend is the start of the official bathing season, during which Sepa monitors pollution from sewers and animal faeces at Scotland's 83 officially designated beaches. Certain bacteria and viruses carried in the water can cause ear and stomach infections in bathers and water users and, in extreme cases, can be fatal.

Levels of contamination are meant to stay within safety limits first laid down 37 years ago by European law, and are due to get much tougher over the next two years. But every year at least some bathing waters breach the limits because of, for example, sewers overflowing or waste from farm animals being washed off the land.

Last year, Sepa introduced a new monitoring system to take advantage of a loophole in the law that allegedly allowed samples to be taken from bathing waters within a five-day period, rather than on a fixed day. The system was explained by Sepa scientist Dr Ruth Stidson at a UK Government conference in Merseyside in March.

The five-day "monitoring window" enabled Sepa's inspectors to choose the days on which they took samples, she said. According to her presentation, they "don't sample if poor water quality is predicted" and instead sample on the "first subsequent day when good water quality is predicted as long as [it is] within five days".

In 2012, only two bathing waters – Heads of Ayr in South Ayrshire and Stonehaven in Aberdeenshire – were declared by Sepa to have breached the safety limits, although two others – Prestwick in South Ayrshire and Sandyhills on the Solway Firth – narrowly missed failing. This compares with four failures in both 2011 and 2010, and seven failures in 2008.

Pollution is relatively easy to predict as it often follows heavy rain, which can overload sewers and mobilise farm wastes. Sepa argued that the rain would put off most beach users, but this was dismissed as "nonsense" by the campaign group Surfers Against Sewage (SAS).

SAS campaigns director, Andy Cummins, said: "We were shocked and disappointed to learn that Sepa were using the five-day sampling window to avoid taking water quality samples when they believed the samples would fail.

"This is clearly an attempt to fudge the results rather than solving the problems facing Scottish beaches, and potentially puts Scottish water users at risk. Actively avoiding taking samples which Sepa feels could fail, and not taking proactive and appropriate steps to warn the public, are not the actions of a responsible regulator."

SAS challenged Sepa to justify its sampling policy, and raised the issue at a meeting with Wheelhouse in Edinburgh last month. It argued that using the five-day window in this way breached the European bathing water directive, and the group threatened to complain to the European Commission.

According to Cummins, the flexibility to take samples over five days was only meant to be used in an emergency, when conditions were dangerous or when inspectors were unable to access beaches. He had been told by the Commission that the provision "should not be used abusively and contrary to the aims of the directive."

Convinced by SAS's arguments, Wheelhouse asked Sepa to stop using the five-day monitoring window at 60 of Scotland's bathing waters. The window can still, however, be used at the 23 remaining beaches where there are electronic signs warning the public about pollution levels.

Though uncomfortable that sampling can still be spread over five days at a minority of bathing waters, SAS claimed victory.

"SAS is pleased with the minister's approach and swift action on this issue," said Cummins.

Wheelhouse told the Sunday Herald that "a pragmatic solution" had been agreed by all parties.

"Accurate information on water quality is important at designated bathing waters not only for bathers, but also for growing watersports such as surfing," he said.

Dr William Gaze, a leading expert in environmental microbiology from the University of Exeter, warned that Sepa's monitoring technique could have prevented some beaches being classified as non-compliant. The health of swimmers and surfers could be put at risk by exposure to faecal bacteria and viruses if warning signs are ignored.

He said: "It would also seem likely that less pressure will be put on water companies to improve coastal water quality if bathing water status is maintained by discounting non-compliant periods of low water quality."

This is not the first time that Sepa has been under fire for downplaying beach pollution.

In 2006, it was accused of "massaging" the figures after every single bathing water was claimed to have met the safety limits – the only year in which such a claim has been made (see timeline, above).

In 2007, the Sunday Herald revealed that Sepa had cut bathing water sampling by 35% over the previous five years. This year the agency is also winding down its monitoring of several beaches that aren't officially designated as bathing waters.

Sepa was unable to estimate what difference use of the five-day monitoring window had made to the status of Scotland's official bathing waters in 2012.

"Unfortunately, there is no data to do this," said Sepa's environmental quality manager, Calum McPhail.

SEPA response

Sepa's environmental quality manager, Calum McPhail, denied the group had cheated or broken European law, arguing that sampling had taken place on days when people were "most likely" to use bathing waters. "Only a limited number of sampling days needed to be changed in 2012 due to adverse weather," he said.

The discussions last month with Scottish Environment Minister, Paul Wheelhouse MSP and campaign group Surfers Against Sewage had been "amicable", but had resulted in Sepa changing its policy so that most bathing waters would now be monitored on pre-arranged days.

"It has been agreed that a modified version of our sampling procedure will be adopted for the 2013 bathing waters season and beyond," McPhail confirmed.

He said Sepa was also proud of its progress in installing real-time warning signs, a move praised by SAS.