Controversial surveillance powers employed to fight terrorism and combat crime have been misused by civil servants in undercover "spying" operations that breach official guidelines, the Guardian has learned.

Documents obtained under Freedom of Information show some government departments and agencies have used these powers incorrectly or without proper controls. They also show the official government watchdog set up to monitor the use of such clandestine techniques criticised the departments for their behaviour.

The watchdog twice threatened to inform Gordon Brown about the serious abuses of powers under the Regulation of Investigatory Powers Act (RIPA).

The watchdog highlighted how:

• Officials at the Department for Environment, Food and Rural Affairs (Defra) did not have proper authorisation when they went undercover posing as anglers to glean information about imported fish;

• A manager responsible for authorising surveillance at the NHS anti-fraud agency routinely gave officials "carte blanche" in surveillance operations;

• Tracking devices were attached to vehicles in a bid to monitor the disposal of waste, after the Environment Agency received apparently incorrect advice from the Home Office

• Potential prosecutions were jeopardised because those conducting the surveillance operations were not properly trained and had not followed procedures

• A large array of public bodies are also using surveillance powers, including the Charity Commission, Royal Pharmaceutical Society and the BBC.

The disclosures come amid mounting criticism of the expansion of state powers to spy on citizens.

The RIPA was introduced in 2000 to regulate surveillance carried out by public bodies to prevent crime, terrorism and protect public safety. Local councils have been accused of going too far by "snooping" on people suspected of dog fouling, fly-tipping or fraudulently applying for a school place.

The Home Office minister Vernon Coaker has said some surveillance has been "inappropriate", while Sir Simon Milton, chairman of the Local Government Association, wrote to every council in England last year urging them to cease using the powers for "trivial" matters.

Reports of inspections by the watchdog, the Chief Surveillance Commissioner, stretching back to 2003 shed new light on how government departments have been using surveillance powers.

The documents obtained highlight how the powers are "widely used" by Royal Mail, which uses hidden "viewing galleries" in sorting officers and local authority CCTV to secretly monitor its staff.

Ofcom, the media regulator, conducted covert surveillance or obtained communications data 177 times in 2007. In the same year the Charity Commission did so three times. Other organisations which have used surveillance powers include Ofsted, the Civil Nuclear Constabulary, the Driving Standards Agency and Food Standards Agency, the Financial Services Authority, the BBC (for TV licensing detection) and the Royal Pharmaceutical Society.

Many of these bodies were found to be abiding by RIPA rules, with only minor infringements.

Sir Christopher Rose, the Chief Surveillance Commissioner, was particularly critical of Defra. In a letter to Helen Ghosh, the department's most senior official, he said that his findings from one inspection made "lamentable reading", adding that his recommendations were "exceptional in number and in seriousness for any organisation inspected by my office".

He found it impossible to discover which senior officials were in charge of making sure the surveillance powers were used lawfully and found the department had not properly authorised the use of undercover officials who were seeking to prevent the illegal importation of live fish.

He said: "The officers concerned were posing as anglers who were engaging other anglers and staff at the fish pond in conversation to elicit information."

He found another case in which an enforcement official seeking to prevent the importation of endangered animals failed to get proper authorisation for an informant because he had not been trained in the surveillance powers. The prosecution had to be dropped. A Defra spokeswoman said that since the 2006, the department had "made considerable progress in dealing with the concerns raised and has now implemented the recommendations in full."

Rose had threatened the unusual step of reporting Defra to Brown if the department did not put its house in order.

His predecessor, Sir Andrew Leggatt, issued the same threat to the Department of Health agency which investigates NHS fraud - the NHS Counter Fraud Service. The surveillance watchdog was concerned about the "authorising officer", then deputy director of operations Allan Carter. It found his written authorisations effectively gave "carte blanche" for any activity "which might be deemed [covert] surveillance".

The watchdog said Carter, who has since been promoted, also made authorisations over the phone. Carter said the watchdog's inspector had "misconstrued the issue of verbal authorisations" and that "no purely verbal authorisations were given".

Carter, who had many other responsibilities, told the watchdog he was "keen to address his lack of knowledge as a matter of urgency".

Yesterday, the NHSCFS said its investigations meet "the highest professional standards" and it has now addressed issues raised in inspections.

The Environment Agency were found to be trespassing on private land to install spy cameras. The agency was also chided in 2007 for attaching tracking devices to a vehicle to monitor the suspected dumping of illegal waste, which constitutes undue interference in private property.

This was done after apparently erroneous advice from the Home Office which stated that "affixing a magnetic device to a vehicle on the public highway" was "not a criminal offence". Pointing out that the advice was wrong, the watchdog advised that if a tracking device was "put into a sack of waste to be collected by the operator this would not be interference".

David Jordan, the Environment Agency's director of operations, said: "The Environment Agency uses covert surveillance to tackle serious environmental crime. We have a very good track record of compliance with RIPA."