The call came early in the end. Around seven. We were on, our contact said. Tonight was the night. We'd been waiting most of the day after last night's plans had been aborted at the eleventh hour. The taxi picked us up, as arranged. The driver had been paid well above the going rate for this and wasn't interested in the details.

Privately, he must have thought it was unusual. Ferrying two foreigners and a fellow countryman deep into the black countryside, dropping them off in the middle of nowhere, returning at a predetermined time unless – as we'd warned him – he got a call stating otherwise.

As the car lights disappeared slowly into the night, someone approached. The security man. He spoke with our translator in haste before beckoning us through the unlocked gate. Across a piece of rough ground, towards one of several vast shed-like buildings set in a row. You could smell it was a farm well before it looked like one. The unmistakable waft of animal waste and straw and feed and chemicals.

Inside, with the door now closed behind us, hundreds of young pigs were visible under the dazzling artificial lights. We didn't have long. The security man had returned to his post outside, to smoke cigarettes and re-read the same paper he'd been reading all evening. He would be watching his clock closely.

The pigs were crammed in; moving, squealing, eating, shitting – these animals didn't have the luxury of outdoor exercise or daylight. This barn (more like a warehouse in fact) was home for now. Locals told us the farm contained 13,000 pigs, and was an intensive piglet "nursery", where young animals were brought from breeding establishments elsewhere to fatten up before being dispatched to the slaughterhouse and people's dinner plates.

We flicked the cameras on – video and stills, as is normal for assignments like this – and recorded what we saw. There were healthy animals, but plenty were lame and injured. One pig had an abnormal growth the size of a grapefruit. Some pigs looked emaciated, others appeared sick, some looked frail. There were dead pigs left abandoned on the ground, live animals rustling around the carcasses.

On the wall, charts recorded the number of animals that had died on specific days, and summarised medical treatment records – the names of antibiotics and other chemicals administered to specific pigs, along with details of the dose.

Time to go, the security man had summoned us. Out through the door, across the rough ground, the taxi was waiting. Handshakes with the security guard – and an acknowledgement of what he'd enabled. It was tricky and risky, sure, he responded, but what did he care, he was leaving in a matter of days. Good luck with the footage, hope it's useful when it's shown god knows where.

As well as the visual evidence of animal welfare conditions, and proof of the drugs in use (difficult to prove usually), we'd collected testimonies from an ex-employee who had spilled the beans on procedures and processes, and from local people, many of who were complaining about the pollution and other environmental impacts of having a foreign-owned factory farm arrive on your doorstep unannounced.

The locals had taken us to a giant open-air waste lagoon linked to another farm run by the same company. We'd filmed dead pigs floating in the cesspit, along with intravenous needles, plastic gloves and other filth.

It was a relief to leave the farm, the region – and indeed the country. On this occasion we were lucky – we got out safely and the pictures and other evidence we'd obtained received much coverage.

But as the detention of Kieron Bryan, the British journalist arrested on board a Greenpeace ship during a recent protest against oil drilling in the Arctic, shows, investigating environmental issues – whether it's climate change, the illegal timber trade or factory farming, can be an increasingly risky business.

Bryan, along with 29 other activists and crew on the Arctic Sunrise, is currently in prison and face potentially lengthy prison sentences after the Russian authorities stormed the boat earlier this month.

Less reported is the fate of Uzbek journalist Sergei Naumov, currently missing after being arrested in September. Naumov is well known for his tireless coverage of environmental issues, in particular the use of forced labour in the country's controversial cotton industry.

Watchdog groups say they are highly concerned as nothing has been heard from the reporter since he telephoned a colleague on the 21st of September to say he'd been detained.

Bryan and Naumov are just the latest in a long line of journalists – and activists – to run into trouble whilst investigating environmental issues. Across the globe, a growing number face persecution and danger – including violence, intimidation, harassment, censorship and even murder – as they tackle controversial, lucrative and often illegal issues.

The problem is so bad that Reporters Without Borders previously compiled a report dedicated to the subject. 'The gathering of [environmental] information alone is threatening for many companies, organised crime groups, governments and the various kinds of intermediaries that profit from the misuse of the environment,' the report states. 'Environmental concerns complicate their plans. As a result, investigative journalists and environmental activists are seen as an unwanted menace and even as enemies to be physically eliminated.'

Those tackling illegal logging and the illicit trade in timber face particular dangers. Logging costs the global economy an estimated US$10-15 billion a year, and there are clear links between deforestation and global warming, as well as serious social justice and human rights abuses involved.

The international community has been slow to recognise the problem however, with resources allocated to fighting the trade hardly registering compared to those allocated to fighting the illicit trades in drugs or arms.

Much of the struggle is being fought – in true David and Goliath style – between a small group of activists and campaigning journalists, and the criminal rackets profiting from the plunder of biologically important rainforests. Those squaring up to these timber barons are paying a heavy price.

In the Philippines in November 2008, journalist Aristeo Padrigao Monday had his face blown off in front of his seven-year-old daughter in Gingoog City after investigating illegal logging for radio station dxRS Radyo Natin and the Mindanao Monitor Today. He had been vocal about the involvement of local politicians. Just months before, in Phnom Penh, Cambodia, journalist Khim Sambo and his son were gunned down in the street. A reporter with newspaper Moneakseka Khmer, Sambo often wrote about illegal logging, including the involvement of powerful government figures.

Many others have been killed, injured or persecuted while tackling logging. The problem is so acute in Indonesia that campaigners created a dedicated security network and emergency 'helpline' for those in trouble.

The move followed shocking cases such as that of Arbi Kusno. A tireless exposer of the illicit timber trade, he was attacked by a mob believed to be working for timber smugglers and armed with spears, machetes and hydrochloric acid. Repeatedly stabbed and slashed, one of Kusno's hands and an ear were severed. His injuries were so severe he was assumed dead and carted off to the morgue – only to regain consciousness en route.

In the US, the latest threats to investigative reporting on environmental issues – food and farming in particular – have come in the guise of a raft of controversial laws: in an attempt to thwart the capacity of investigative journalists and activist groups reporting on food scoops, recent years have seen a wave of so-called "ag-gag" legislation introduced in many US states.

Seven states currently have "ag gags" in place, including Iowa, Missouri and North Dakota; seven are believed to have laws pending, including Pennsylvania; and three, California among them, have withdrawn similar legislation. Although details vary from state to state, the premise is the same: to criminalise those who seek to record evidence of animal cruelty and other abuses at factory farms or other farm-related locations.

In Iowa, successfully obtaining employment at agricultural premises under false pretences was made illegal in March 2012. In North Dakota, similar legislation was passed as far back as 1991, making it an offence to trespass or create a recording at a farm. In Missouri, a law passed in July 2012 forces an undercover investigator or journalist to officially report any animal rights abuses seen within 24 hours of their discovery.

New Mexico and California have both recently seen "ag-gags" introduced, but the proposed laws were rejected following public concerns. In Pennsylvania, legislation currently being considered seeks to outlaw trespass and filming at factory farms.

Such unprecedented attempts to stifle investigations are being made, quite simply, because they are bad for PR – especially when accompanied by powerful video images – and thus bad for business. They hit companies where it hurts by shocking consumers and galvanising opinion.

A groundbreaking investigation released in 2008 by pressure group Humane Society of the United States resulted in the largest meat recall in US history, after an undercover worker at the Westland/Hallmark slaughterhouse in California secretly filmed horrific treatment of cattle. The facility had supplied beef to schools across the US.

And campaigners say there is a direct correlation between such image-denting investigations and the roll out of "ag-gags": hot on the heels of "watershed moment" undercover filming by the Mercy For Animals' group at Butterball turkey farms in North Carolina, legislation which hampers this kind of journalism was rolled out.

The investigation, the results of which were published in 2011, led to several arrests and convictions of workers who were caught on camera maliciously abusing animals, including the first ever felony conviction related to cruelty to farmed poultry in US history. The probe also led to the conviction of a senior Department of Agriculture official for obstruction of justice after she attempted to forewarn Butterball that law enforcement planned to raid the company's facility, says Mercy For Animals.

Some commentators believe the current crop of "ag-gags" have borrowed from the model adopted by the controversial American Legislative Exchange Council (ALEC). The powerful lobby group – made up of corporations and politicians – crafts laws, according to its critics, which serve members' own vested interests before handing them over, pre-packaged and ready to roll, to legislators on a state by state basis.

Unsurprisingly, many food corporations and agricultural organisations support ALEC, which in 2003 introduced the contentious Animal and Ecological Terrorism Act, a federal law designed to target radical environmental and animal rights groups. Some fear that "ag-gags", designed to suppress investigations into factory farming, could be used to target activists and journalists probing other aspects of the food industry or other issues altogether.

Recent years have seen an explosion of investigative reporting being used to highlight, amongst other things, exploitation of migrant workers harvesting fruit and vegetable crops, and poor conditions for those toiling unseen in many restaurant kitchens.

The fallout from these investigations can be just as damaging – and costly – as exposes of farm animal cruelty, particularly when the findings provoke a public outcry. In the ground-breaking book Tomatoland, an examination of the tomato growing industry, journalist Barry Estabrook highlighted the shocking case of the "Immokalee babies" born with severe deformities after their mothers were exposed to pesticides whilst harvesting tomatoes.

Working undercover carries its own inherent risks – not least being caught red-handed whilst wearing a hidden camera or disturbed after entering a property clandestinely – and both activists and journalists, including colleagues of mine, have been threatened or attacked while carrying out their work.

In Brazil, in 2006, one undercover researcher investigating the impacts of the export-led cattle industry was outed in a chilling advert placed in a local newspaper and had to quickly flee the region. His safety – and that of colleagues – was judged to be under threat.

In Japan, two investigators were almost killed in 2003 while trying to document the controversial Taiji dolphin hunt. Morgan Whorwood and Brooke McDonald managed to obtain graphic film of the slaughter of striped dolphins, killed for their meat, but desperate to seize the footage, fishermen attempted to throw the pair off a cliff into the sea.

Although they managed to smuggle the footage out – subsequently beamed around the world and temporarily halting the Taiji killing – the activists were forced to leave Japan after receiving threats.

Legal threats are also a constant peril. Again in Japan, activists from Greenpeace went undercover to expose an embezzlement ring involving crew members working on the whaling ship Nisshin Maru. Following revelations that some of the ship's crew were linked to the illegal sale of whale meat, in 2008, Japanese police raided Greenpeace offices in Tokyo, and the homes of Greenpeace staff; two campaigners – Junichi Sato and Toru Suzuki – were arrested and held in jail for their part in exposing the corruption. Another member of the investigative team cannot return to Japan for fear of being prosecuted.

In 2009 journalists from the UK-based investigative outfit Ecostorm were beaten and arrested whilst documenting the Namibian seal hunt, which is less well known than its Canadian counterpart.

Those investigating large corporations also run the risk of being sued for libel. Swedish journalist Fredrik Gertten was targeted by US fruit company Dole Food in 2009 after releasing a documentary, Bananas!,examining the risks to plantation workers' health from pesticides used on company farms. Dole launched a lawsuit against the Gertten documentary and lobbied the Los Angeles Film Festival to have that documentary removed from its bill, leading to allegations of censorship. It was screened but not as part of the main festival competition.

Similarly, UK filmmaker Tracy Worcester's Pig Business documentary was the subject of several legal threats by pork giant Smithfield Foods in 2008 and 2009. The company sent four letters to Channel 4 threatening legal action, the last of which was sent an hour before the film was broadcast. As a result of the letter, Channel 4 delayed broadcast of the film and footage was removed in order to make one of the perpetrators less identifiable. The lawyers acting on behalf of the company also contacted London's Barbican arts centre, claiming the film was defamatory and asking them not to show it. The screening only went ahead after Worcester agreed to indemnify the Barbican.

Sometimes, the threats – and the dangers – can be more subtle. While I was investigating slave labour and environmental linked to southern Italy's orange and tomato harvests, where thousands of (largely African) migrants suffer brutal exploitation and squalid living conditions, we asked who was really running the show – not the gangmasters, farmers or processors who undoubtedly turn a blind eye to the suffering, but someone else; someone who was benefitting, financially or otherwise, from the racket.

We never had a firm answer. Nobody knew for sure – or would say. Why ask, people said, it makes no difference. The problem is what it is. It was a question better not to answer. This is mafia country after all.