Almost two years ago, one of my oldest friends, Bradley L Garrett, boarded a plane at Heathrow airport. As it taxied on the runway, the British Transport Police arrived and dragged him off the plane. He was accused of conspiracy to commit criminal damage.

Garrett, a geographer at the University of Oxford, originally from the US, went on trial earlier this month for alleged crimes surrounding his research into urban exploration.

He has been handed a conditional discharge, which basically means he is off the hook as long as he doesn’t do it again. But his story should act as a warning to researchers and to anyone who benefits from researchers gathering information about human beings. In other words, everyone.

While Garrett clearly crossed certain legal boundaries, by embarking on what he called “recreational” trespass, he did so as an ethnographer conducting legitimate social scientific research for what he considered the public good.

In the course of four years of ethnographic work, Garrett became very intimate with urban explorers and with this access was able to write a book of stunning detail about urban exploration in London and beyond. These explorers journey into buildings, construction sites and sewers, photographing the scenes as they go.

Whether urban explorers are aware of it or not, their photographs show us how much of the world has been privatised, permanently segregated from the public by locks, hired guards, barbed wire and surveillance cameras for exclusive use by financial elites. This insight is a direct result of Garrett hanging out with these Underground spelunkers and skyscraper climbers. But hanging out with them also landed him in court.

Ethnographers do some deep hanging out. They work, play, live, joke, eat and sometimes fall in love with their subjects. The method builds empathy, rapport, trust, and ideally a transformation of the researcher into a person who has internalised and can communicate a small understanding of the values, discourses, and practices of the people they observe.

Since Garrett was prosecuted, we should be concerned about the chilling effect his case may have on social scientific research.

Though this right appears to be eroding around the world, some journalists, such as those in the United States, are provided constitutional protection against incrimination through association. Their work, to hold the powerful to account for their actions, is considered a necessary part of democracy.

Social scientists are not so fortunate as to have a constitutionally protected right to freedom of research. The reasons for this omission are many. Scholars can be more reclusive than journalists by nature and can find it difficult to show a direct or quick link between their work and the public good. Whatever the reason, we have not done an effective job of communicating and defending the “public good” of our research and the legitimacy of our methods.

Ethnographers and sociologists have long lived with people deemed criminals. They spend time with gang members, prostitutes, drug users, gamblers, white collar hustlers, organ dealers, illegal loggers, people in ethnic revolt, militant ecologists, postcolonial resistance movements, the list goes on.

This happens because cultural upheaval so often tends to happen on the edge of legality. Revolutionary mobilisation, hacktivism, immigrant protest, illegal file sharing, state-based mass surveillance, are all examples of important cultural shifts that we need to study but that may involve crossing criminal boundaries.

Deep hanging out in illegal and semi-legal situations could result in transformative social science which should be protected for the insights it provides into subcultural formation, identity construction, and how domination is exercised and resisted.

I was worried about my friend. A conviction would have threatened his right to stay in the UK. But the case also worried me on a professional level. My own research into hacker activism requires me to talk to people working the boundaries between cyberactivism and cybercrime. To build trust and better understand their worldview, I go to their real-world protests, hang out in their anonymous chatrooms and dark nets, repost and reblog their public revolutionary commentary, and remix their radical propaganda.

I empathise publicly and privately with their multidimensional fight against a corporatised internet. When you “go native” when do you cross the line?

The very fact that Garrett faced criminal charges means that courts and cops are willing to challenge the sanctity of universities, social science, and ethnography – at least in comparison to the legitimacy it grants to private property owners in the London fortress. A conviction would have had a chilling impact on any researchers willing to learn about the lifeworlds of those living on the edge of legality. Unfortunately, that is also the cutting-edge of social scientific research.