Think of your favourite memory and a rush of things probably come through your mind: where it happened, how old you were, who you were with. And those things are exactly how you’re able to delete things you don’t want to remember.

Scientists in a recent study have shown the ways that those kinds of context help support the memories in our head. And getting rid of them can be a trick to deleting things that you’d rather forget.

The study – done at Dartmouth and Princeton universities – found that people can intentionally forget their experiences if they change the context that they think about them in. The researchers have suggested that same information could eventually be used to enhance the memories we’d rather keep and help people to store things in their heads, as well as downplaying the effect that harmful memories can have on people.

The role that context plays in memory has been known since Ancient Greece. It can be experienced when recalling your own memory: each of them appears as a knot of sights, sounds and smells as well as stories, which together

But new research has shown precisely how that context works – and how effective it can be at getting rid of it.

The study worked by asking people to study two lists of random words, while they were shown images of outdoor scenes that included things like forests, mountains and beaches. They were told either to forget or remember the first list, and then study the second list.

They used fMRI scanners to track how much people were thinking about those scenes during the experiment. That meant that the researchers could track in real time how much people were thinking about those contexts as they thought about remembering or forgetting the words.

They found that when people were told to forget the words, the scans showed that they were “flushing out” the context from their brains. That means that the brain automatically gets rid of the context it doesn’t need – and confirming it might make us even better at remembering.

And the researchers even found that the more people were able to flush out those thoughts, the less they’d remember.

The study was rare because it focused on forgetting, rather than remembering. Scientists studying memory usually focus on how we remember things, and consider the act of forgetting a kind of failure – but “deleting” information from our minds might be just as important.

It could serve important functions for those suffering post traumatic stress disorder, for instance. And it might have more pedestrian functions – allowing people to more easily put things out of their mind that make them upset or distracted.

It might even be that getting rid of certain information actually clears space for the new. If people are able to encourage this “flushing” process by changing the contexts that memories exist in, they might be able to fill that mental space with new memories, scientists say – potentially making us better at remembering, as well as more efficiently forgetful.